473,699 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to insert PowerPoint in c sharp

1 New Member
I want the codes for inserting powerpoint in a c# starting from using system.
I use using Microsoft.Offic e. PowerPoint and the office has been underlined
Jan 2 '19 #1
1 12370
Cezar
3 New Member
Hi, what you mean by "insert"? If you meant to create PowerPoint documents using C#, you can use Free Spire.Presentat ion, which is a C# class library for processing PPT and PPTX files in .NET.

The following is the code snippet of creating a simple PowerPoint using it.

Expand|Select|Wrap|Line Numbers
  1. using Spire.Presentation;
  2. using System.Drawing;
  3.  
  4. namespace CreatePowerPointInCsharp
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             //Create a Presentation object
  11.             Presentation presentation = new Presentation();
  12.  
  13.             //Add a new shape to the document
  14.             RectangleF rec = new RectangleF(presentation.SlideSize.Size.Width / 2 - 250, 80, 500, 150);
  15.             IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, rec);
  16.             shape.ShapeStyle.LineColor.Color = Color.White;
  17.             shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
  18.  
  19.             //Add text to the shape
  20.             shape.AppendTextFrame("Hello World!");
  21.  
  22.             //Set the font and fill style of the text
  23.             TextRange textRange = shape.TextFrame.TextRange;
  24.             textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
  25.             textRange.Fill.SolidColor.Color = System.Drawing.Color.CadetBlue;
  26.             textRange.FontHeight = 66;
  27.             textRange.LatinFont = new TextFont("Lucida Sans Unicode");
  28.  
  29.             //Save the document
  30.             presentation.SaveToFile("HelloWorld.pptx", FileFormat.Pptx2013);
  31.         }
  32.     }
  33. }
  34.  
Jan 24 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
17337
by: Levi | last post by:
How can I use php and mysql to create a downloadable .ppt file from the php-made output?
6
3406
by: C Williams | last post by:
Hi, I am writing some VB.NET code that compiles to a dll. There is some code within it that manipulates Powerpoint 2003. The dll I am writing is for smart tags, and I am having trouble because sometimes Powerpoint is remaining running (powerpnt.exe in Task Manager). One action of my smart tags calls InsertChart (code below). The designated line causes powerpoint to remain running even after the user has manually closed the...
6
5063
by: Oliver Drobnik | last post by:
Hi, I would like to write a Control in vb.net that I would be able to embed in a Powerpoint presentation to display custom data. Nothing overly fancy. Is this possible? (COM Interop?) What would I need to do? Could anyone provide me with a brief sample "Hello World"? kind regards
8
7073
by: Rut | last post by:
Does anyone know how to start powerpoint from vb.net without the ppt screen appearing. I want to keep it hidden? Using this code: Try pp = New PowerPoint.Application pp.Visible = Office.MsoTriState.msoTrue pp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized Application.DoEvents()
1
22773
by: ellenh | last post by:
I have read postings on the similar subject including the posting from 2003 shown below. This process works fine to display a single page snapshot report in PowerPoint. I need to display subsequent pages from the same snapshot file in subsequent slides in PowerPoint. I realize that it is possible to add VB code to the Snapshot Viewer Control and that there are properties such as .FirstPage, .NextPage, .LastPage, etc, But I can't find...
3
5467
by: amanda1 | last post by:
I have a flyer made in powerpoint and I need to send it using outlook. However, the picture is blurry when I send it. I have tried making it a JPG, copy and paste, image etc. Anyone have any tips on how to make an image sharp in the body of an email?
1
2279
by: bsg92150 | last post by:
i have a task that requires me to provide a web use with the ability to send teh current page to a power point slide. and to further complicate matters. the user may want to put the whole site into a slide. the problem is that the information is database driven and the user may not have visted the pages tha/ thankst he is requestion to download. my question is is this possable and is there an example out there that i can look at
1
11889
by: chrizstone | last post by:
Hi Guys, What i want to do is: I want to create a Slide programmatically where a Table is on it! Here´s my Code: String strTemplate; strTemplate = template; String tableSlide = @"C:\Temp\TableSlide_" + guid.ToString();
6
6198
doma23
by: doma23 | last post by:
Currently I'm working on development of an access application that deals with some fiancial data. I need a button on access form that will when clicked open powerpoint file and create and insert all the graphs from the underlying access data. This is what I've done so far: I've created a macro that extract necessary access data from a predefined query and converts it to xls. Then I've made the second xls file that extracts the data from...
0
8692
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9181
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9040
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8889
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.