|
1 | | - |
2 | | -using Syncfusion.Presentation; |
| 1 | +using Syncfusion.Presentation; |
3 | 2 | using System; |
4 | 3 |
|
5 | | -namespace Create_PowerPoint_presentation |
6 | | -{ |
7 | | - class Program |
8 | | - { |
9 | | - static void Main(string[] args) |
10 | | - { |
11 | | - //Create a new instance of PowerPoint Presentation file |
12 | | - using (IPresentation pptxDoc = Presentation.Create()) |
13 | | - { |
14 | | - //Add a new slide to file and apply background color |
15 | | - ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.TitleOnly); |
16 | | - //Specify the fill type and fill color for the slide background |
17 | | - slide.Background.Fill.FillType = FillType.Solid; |
18 | | - slide.Background.Fill.SolidFill.Color = ColorObject.FromArgb(232, 241, 229); |
19 | | - //Add title content to the slide by accessing the title placeholder of the TitleOnly layout-slide |
20 | | - IShape titleShape = slide.Shapes[0] as IShape; |
21 | | - titleShape.TextBody.AddParagraph("Company History").HorizontalAlignment = HorizontalAlignmentType.Center; |
22 | | - //Add description content to the slide by adding a new TextBox |
23 | | - IShape descriptionShape = slide.AddTextBox(53.22, 141.73, 874.19, 77.70); |
24 | | - descriptionShape.TextBody.Text = "IMN Solutions PVT LTD is the software company, established in 1987, by George Milton. The company has been listed as the trusted partner for many high-profile organizations since 1988 and got awards for quality products from reputed organizations."; |
25 | | - //Add bullet points to the slide |
26 | | - IShape bulletPointsShape = slide.AddTextBox(53.22, 270, 437.90, 116.32); |
27 | | - //Add a paragraph for a bullet point |
28 | | - IParagraph firstPara = bulletPointsShape.TextBody.AddParagraph("The company acquired the MCY corporation for 20 billion dollars and became the top revenue maker for the year 2015."); |
29 | | - //Format how the bullets should be displayed |
30 | | - firstPara.ListFormat.Type = ListType.Bulleted; |
31 | | - firstPara.LeftIndent = 35; |
32 | | - firstPara.FirstLineIndent = -35; |
33 | | - // Add another paragraph for the next bullet point |
34 | | - IParagraph secondPara = bulletPointsShape.TextBody.AddParagraph("The company is participating in top open source projects in automation industry."); |
35 | | - //Format how the bullets should be displayed |
36 | | - secondPara.ListFormat.Type = ListType.Bulleted; |
37 | | - secondPara.LeftIndent = 35; |
38 | | - secondPara.FirstLineIndent = -35; |
39 | | - //Gets a picture as stream. |
40 | | - FileStream pictureStream = new FileStream(Path.GetFullPath(@"Data/Image.jpg"), FileMode.Open); |
41 | | - //Adds the picture to a slide by specifying its size and position. |
42 | | - slide.Shapes.AddPicture(pictureStream, 499.79, 238.59, 364.54, 192.16); |
43 | | - //Add an auto-shape to the slide |
44 | | - IShape stampShape = slide.Shapes.AddShape(AutoShapeType.Explosion1, 48.93, 430.71, 104.13, 80.54); |
45 | | - //Format the auto-shape color by setting the fill type and text |
46 | | - stampShape.Fill.FillType = FillType.None; |
47 | | - stampShape.TextBody.AddParagraph("IMN").HorizontalAlignment = HorizontalAlignmentType.Center; |
48 | | - //Save the PowerPoint Presentation as stream |
49 | | - using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Sample.pptx"), FileMode.Create)) |
50 | | - { |
51 | | - pptxDoc.Save(outputStream); |
52 | | - } |
53 | | - } |
54 | | - } |
55 | | - } |
56 | | -} |
| 4 | +//Create a new instance of PowerPoint Presentation file |
| 5 | +IPresentation pptxDoc = Presentation.Create(); |
| 6 | +//Add a new slide to file and apply background color |
| 7 | +ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.TitleOnly); |
| 8 | +//Specify the fill type and fill color for the slide background |
| 9 | +slide.Background.Fill.FillType = FillType.Solid; |
| 10 | +slide.Background.Fill.SolidFill.Color = ColorObject.FromArgb(232, 241, 229); |
| 11 | +//Add title content to the slide by accessing the title placeholder of the TitleOnly layout-slide |
| 12 | +IShape titleShape = slide.Shapes[0] as IShape; |
| 13 | +titleShape.TextBody.AddParagraph("Company History").HorizontalAlignment = HorizontalAlignmentType.Center; |
| 14 | +//Add description content to the slide by adding a new TextBox |
| 15 | +IShape descriptionShape = slide.AddTextBox(53.22, 141.73, 874.19, 77.70); |
| 16 | +descriptionShape.TextBody.Text = "IMN Solutions PVT LTD is the software company, established in 1987, by George Milton. The company has been listed as the trusted partner for many high-profile organizations since 1988 and got awards for quality products from reputed organizations."; |
| 17 | +//Add bullet points to the slide |
| 18 | +IShape bulletPointsShape = slide.AddTextBox(53.22, 270, 437.90, 116.32); |
| 19 | +//Add a paragraph for a bullet point |
| 20 | +IParagraph firstPara = bulletPointsShape.TextBody.AddParagraph("The company acquired the MCY corporation for 20 billion dollars and became the top revenue maker for the year 2015."); |
| 21 | +//Format how the bullets should be displayed |
| 22 | +firstPara.ListFormat.Type = ListType.Bulleted; |
| 23 | +firstPara.LeftIndent = 35; |
| 24 | +firstPara.FirstLineIndent = -35; |
| 25 | +// Add another paragraph for the next bullet point |
| 26 | +IParagraph secondPara = bulletPointsShape.TextBody.AddParagraph("The company is participating in top open source projects in automation industry."); |
| 27 | +//Format how the bullets should be displayed |
| 28 | +secondPara.ListFormat.Type = ListType.Bulleted; |
| 29 | +secondPara.LeftIndent = 35; |
| 30 | +secondPara.FirstLineIndent = -35; |
| 31 | +//Gets a picture as stream. |
| 32 | +FileStream pictureStream = new FileStream(Path.GetFullPath(@"Data/Image.jpg"), FileMode.Open); |
| 33 | +//Adds the picture to a slide by specifying its size and position. |
| 34 | +slide.Shapes.AddPicture(pictureStream, 499.79, 238.59, 364.54, 192.16); |
| 35 | +//Add an auto-shape to the slide |
| 36 | +IShape stampShape = slide.Shapes.AddShape(AutoShapeType.Explosion1, 48.93, 430.71, 104.13, 80.54); |
| 37 | +//Format the auto-shape color by setting the fill type and text |
| 38 | +stampShape.Fill.FillType = FillType.None; |
| 39 | +stampShape.TextBody.AddParagraph("IMN").HorizontalAlignment = HorizontalAlignmentType.Center; |
| 40 | +//Save the PowerPoint Presentation as stream |
| 41 | +using FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Sample.pptx"), FileMode.Create); |
| 42 | +pptxDoc.Save(outputStream); |
0 commit comments