Interface IPresentation
Represents the PowerPoint presentation.
Inherited Members
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IPresentation : IDisposable
Properties
BuiltInDocumentProperties
Gets an IBuiltInDocumentProperties instance that represents the built in document properties of presentation. Read-only.
Declaration
IBuiltInDocumentProperties BuiltInDocumentProperties { get; }
Property Value
Type | Description |
---|---|
IBuiltInDocumentProperties |
Examples
//Create an instance for presentation.
IPresentation presentation = Presentation.Create();
//Retrieve the built-in document property, it is read only
IBuiltInDocumentProperties builtin = presentation.BuiltInDocumentProperties;
//Set the application name
builtin.ApplicationName = "Essential Presentation";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create an instance for presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the built-in document property, it is read only
Dim builtin As IBuiltInDocumentProperties = presentation__1.BuiltInDocumentProperties
'Set the application name
builtin.ApplicationName = "Essential Presentation"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
ChartToImageConverter
Gets the IOfficeChartToImageConverter instance.
Declaration
IOfficeChartToImageConverter ChartToImageConverter { get; set; }
Property Value
Type | Description |
---|---|
IOfficeChartToImageConverter |
Remarks
Initialize the ChartToImageConverter in-order to convert the chart in presentation to image.
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Initialize the chart to image converter.
presentation.ChartToImageConverter = new ChartToImageConverter();
//Set the scaling mode for the chart.
presentation.ChartToImageConverter.ScalingMode = ScalingMode.Best;
//Add a blank slide for the chart.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a chart to the slide.
IPresentationChart officeChart = slide.Charts.AddChart(100, 100, 600, 400);
//Set chart data
officeChart.ChartData.SetValue(1, 4, "Month");
officeChart.ChartData.SetValue(2, 4, "July");
officeChart.ChartData.SetValue(3, 4, "August");
officeChart.ChartData.SetValue(4, 4, "September");
officeChart.ChartData.SetValue(5, 4, "October");
officeChart.ChartData.SetValue(6, 4, "November");
officeChart.ChartData.SetValue(7, 4, "December");
officeChart.ChartData.SetValue(1, 1, "2013");
officeChart.ChartData.SetValue(2, 1, 35);
officeChart.ChartData.SetValue(3, 1, 37);
officeChart.ChartData.SetValue(4, 1, 30);
officeChart.ChartData.SetValue(5, 1, 29);
officeChart.ChartData.SetValue(6, 1, 25);
officeChart.ChartData.SetValue(7, 1, 30);
officeChart.ChartData.SetValue(1, 2, "2014");
officeChart.ChartData.SetValue(2, 2, 30);
officeChart.ChartData.SetValue(3, 2, 25);
officeChart.ChartData.SetValue(4, 2, 29);
officeChart.ChartData.SetValue(5, 2, 35);
officeChart.ChartData.SetValue(6, 2, 38);
officeChart.ChartData.SetValue(7, 2, 32);
officeChart.ChartData.SetValue(1, 3, "2015");
officeChart.ChartData.SetValue(2, 3, 35);
officeChart.ChartData.SetValue(3, 3, 37);
officeChart.ChartData.SetValue(4, 3, 30);
officeChart.ChartData.SetValue(5, 3, 50);
officeChart.ChartData.SetValue(6, 3, 25);
officeChart.ChartData.SetValue(7, 3, 30);
//Add chart serie.
IOfficeChartSerie serie1 = officeChart.Series.Add("2013");
//Set serie value.
serie1.Values = officeChart.ChartData[2, 1, 7, 1];
//Add chart serie.
IOfficeChartSerie serie2 = officeChart.Series.Add("2014");
//Set serie value.
serie2.Values = officeChart.ChartData[2, 2, 7, 2];
//Add chart serie.
IOfficeChartSerie serie3 = officeChart.Series.Add("2015");
//Set serie value.
serie3.Values = officeChart.ChartData[2, 3, 7, 3];
//Set category labels value for the primary category axis.
officeChart.PrimaryCategoryAxis.CategoryLabels = officeChart.ChartData[2, 4, 7, 4];
//Set the chart type.
officeChart.ChartType = OfficeChartType.Column_Clustered;
//Set the chart title.
officeChart.ChartTitle = "Mine Chart";
//Convert the chart to image.
System.Drawing.Image[] chartImages = presentation.RenderAsImages(Syncfusion.Drawing.ImageType.Metafile);
foreach (System.Drawing.Image image in chartImages)
{
//Save the image.
image.Save("ChartToImageConverter" + Guid.NewGuid() + ".png");
}
//Save the presentation.
presentation.Save("ChartToImageConverter.pptx");
//Close the presentation.
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Initialize the chart to image converter.
presentation__1.ChartToImageConverter = New ChartToImageConverter()
'Set the scaling mode for the chart.
presentation__1.ChartToImageConverter.ScalingMode = ScalingMode.Best
'Add a blank slide for the chart.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a chart to the slide.
Dim officeChart As IPresentationChart = slide.Charts.AddChart(100, 100, 600, 400)
'Set chart data
officeChart.ChartData.SetValue(1, 4, "Month")
officeChart.ChartData.SetValue(2, 4, "July")
officeChart.ChartData.SetValue(3, 4, "August")
officeChart.ChartData.SetValue(4, 4, "September")
officeChart.ChartData.SetValue(5, 4, "October")
officeChart.ChartData.SetValue(6, 4, "November")
officeChart.ChartData.SetValue(7, 4, "December")
officeChart.ChartData.SetValue(1, 1, "2013")
officeChart.ChartData.SetValue(2, 1, 35)
officeChart.ChartData.SetValue(3, 1, 37)
officeChart.ChartData.SetValue(4, 1, 30)
officeChart.ChartData.SetValue(5, 1, 29)
officeChart.ChartData.SetValue(6, 1, 25)
officeChart.ChartData.SetValue(7, 1, 30)
officeChart.ChartData.SetValue(1, 2, "2014")
officeChart.ChartData.SetValue(2, 2, 30)
officeChart.ChartData.SetValue(3, 2, 25)
officeChart.ChartData.SetValue(4, 2, 29)
officeChart.ChartData.SetValue(5, 2, 35)
officeChart.ChartData.SetValue(6, 2, 38)
officeChart.ChartData.SetValue(7, 2, 32)
officeChart.ChartData.SetValue(1, 3, "2015")
officeChart.ChartData.SetValue(2, 3, 35)
officeChart.ChartData.SetValue(3, 3, 37)
officeChart.ChartData.SetValue(4, 3, 30)
officeChart.ChartData.SetValue(5, 3, 50)
officeChart.ChartData.SetValue(6, 3, 25)
officeChart.ChartData.SetValue(7, 3, 30)
'Add chart serie.
Dim serie1 As IOfficeChartSerie = officeChart.Series.Add("2013")
'Set serie value.
serie1.Values = officeChart.ChartData(2, 1, 7, 1)
'Add chart serie.
Dim serie2 As IOfficeChartSerie = officeChart.Series.Add("2014")
'Set serie value.
serie2.Values = officeChart.ChartData(2, 2, 7, 2)
'Add chart serie.
Dim serie3 As IOfficeChartSerie = officeChart.Series.Add("2015")
'Set serie value.
serie3.Values = officeChart.ChartData(2, 3, 7, 3)
'Set category labels value for the primary category axis.
officeChart.PrimaryCategoryAxis.CategoryLabels = officeChart.ChartData(2, 4, 7, 4)
'Set the chart type.
officeChart.ChartType = OfficeChartType.Column_Clustered
'Set the chart title.
officeChart.ChartTitle = "Mine Chart"
'Convert the chart to image.
Dim chartImages As Image() = presentation__1.RenderAsImages(Syncfusion.Drawing.ImageType.Metafile)
For Each image As Image In chartImages
'Save the image.
image.Save("ChartToImageConverter" + Guid.NewGuid() + ".png")
Next
'Save the presentation.
presentation__1.Save("ChartToImageConverter.pptx")
'Close the presentation.
presentation__1.Close()
CustomDocumentProperties
Gets an ICustomDocumentProperties instance that represents the custom document properties of presentation. Read-only.
Declaration
ICustomDocumentProperties CustomDocumentProperties { get; }
Property Value
Type | Description |
---|---|
ICustomDocumentProperties |
Examples
//Create a new presentation
IPresentation presentation = Presentation.Create();
//Retrieve the custom document properties.
ICustomDocumentProperties customDocumentProperties = presentation.CustomDocumentProperties;
//Add a new custom document property
customDocumentProperties.Add("Property1");
//Set a Boolean value.
customDocumentProperties["Property1"].Boolean = true;
//Add a new custom document property
customDocumentProperties.Add("Property2");
//Set a date time.
customDocumentProperties["Property2"].DateTime = DateTime.Now;
//Save the presentation
presentation.Save("CustomProperty.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Retrieve the custom document properties.
Dim customDocumentProperties As ICustomDocumentProperties = presentation__1.CustomDocumentProperties
'Add a new custom document property
customDocumentProperties.Add("Property1")
'Set a Boolean value.
customDocumentProperties("Property1").[Boolean] = True
'Add a new custom document property
customDocumentProperties.Add("Property2")
'Set a date time.
customDocumentProperties("Property2").DateTime = DateTime.Now
'Save the presentation
presentation__1.Save("CustomProperty.pptx")
'Close the presentation
presentation__1.Close()
Final
Gets or sets a value indicating whether the IPresentation instance is marked as final.
Declaration
bool Final { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FontSettings
Declaration
FontSettings FontSettings { get; }
Property Value
Type | Description |
---|---|
FontSettings |
HasMacros
Gets whether the presentation has macros. Read-only.
Declaration
bool HasMacros { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsWriteProtected
Gets whether the presentation is write Protected. Read-only.
Declaration
bool IsWriteProtected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
//Create an instance for presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Check whether the presentation is write protected.
if (presentation.IsWriteProtected)
{
//Removes the write protection from presentation instance
presentation.RemoveWriteProtection();
}
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation.
presentation.Close();
'Create an instance for presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Check whether the presentation is write protected.
if (presentation.IsWriteProtected)
{
'Removes the write protection from presentation instance
presentation.RemoveWriteProtection()
}
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation.
presentation.Close()
Masters
Gets the IMasterSlides collection of the IPresentation instance. Read-only.
Declaration
IMasterSlides Masters { get; }
Property Value
Type | Description |
---|---|
IMasterSlides |
Sections
Returns a collection of ISection instances. Read-only.
Declaration
ISections Sections { get; }
Property Value
Type | Description |
---|---|
ISections |
Slides
Gets the slide collection in the presentation. Read-only.
Declaration
ISlides Slides { get; }
Property Value
Type | Description |
---|---|
ISlides |
Examples
//Open a presentation.
IPresentation presentation = Presentation.Open("Input.pptx");
//Retrieve the slide collection, it is read only
ISlides slides = presentation.Slides;
//Add a slide to the presentation
ISlide slide = slides[0];
//Create instance for slide background
IBackground background = slide.Background;
//Set the fill type for background as Pattern fill
background.Fill.FillType = FillType.Pattern;
//Set the pattern
background.Fill.PatternFill.Pattern = PatternFillType.DashedHorizontal;
//set the fore color of pattern
background.Fill.PatternFill.ForeColor = ColorObject.Lavender;
//Set the back color of pattern
background.Fill.PatternFill.BackColor = ColorObject.Brown;
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Open a presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Input.pptx")
'Retrieve the slide collection, it is read only
Dim slides As ISlides = presentation__1.Slides
'Add a slide to the presentation
Dim slide As ISlide = slides(0)
'Create instance for slide background
Dim background As IBackground = slide.Background
'Set the fill type for background as Pattern fill
background.Fill.FillType = FillType.Pattern
'Set the pattern
background.Fill.PatternFill.Pattern = PatternFillType.DashedHorizontal
'set the fore color of pattern
background.Fill.PatternFill.ForeColor = ColorObject.Lavender
'Set the back color of pattern
background.Fill.PatternFill.BackColor = ColorObject.Brown
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Methods
Clone()
Creates an independent copy of IPresentation instance.
Declaration
IPresentation Clone()
Returns
Type | Description |
---|---|
IPresentation | Returns the cloned presentation instance. |
Examples
//Create an instance for presentation
IPresentation presentation = Presentation.Create();
//Add a new slide of comparison slide layout type.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Comparison);
//Clone the entire presentation.
IPresentation presentationClone = presentation.Clone();
//Add a new slide of title layout type.
slide = presentationClone.Slides.Add(SlideLayoutType.Title);
//Add an auto shape of regular pentagon auto shape type.
slide.Shapes.AddShape(AutoShapeType.RegularPentagon, 10, 20, 300, 400);
//Save the cloned presentation
presentationClone.Save("Sample.pptx");
//Close the presentation.
presentation.Close();
//Close the cloned presentation.
presentationClone.Close();
'Create an instance for presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a new slide of comparison slide layout type.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Comparison)
'Clone the entire presentation.
Dim presentationClone As IPresentation = presentation__1.Clone()
'Add a new slide of title layout type.
slide = presentationClone.Slides.Add(SlideLayoutType.Title)
'Add an auto shape of regular pentagon auto shape type.
slide.Shapes.AddShape(AutoShapeType.RegularPentagon, 10, 20, 300, 400)
'Save the cloned presentation
presentationClone.Save("Sample.pptx")
'Close the presentation.
presentation__1.Close()
'Close the cloned presentation.
presentationClone.Close()
Close()
Releases any resources associated with the presentation instance.
Declaration
void Close()
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a new slide of comparison slide layout type.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Comparison);
//Save the presentation.
presentation.Save("Sample.pptx");
//Close the presentation.
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a new slide of comparison slide layout type.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Comparison)
'Save the presentation.
presentation__1.Save("Sample.pptx")
'Close the presentation.
presentation__1.Close()
Encrypt(String)
Encrypts the presentation using the specified password.
Declaration
void Encrypt(string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | password | The password to encrypt the presentation. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a new slide of content with caption slide layout type.
ISlide slide = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
//Add a auto shape of moon type auto shape.
IShape shape = slide.Shapes.AddShape(AutoShapeType.Moon, 50, 0, 200, 200);
//Add a paragraph with text content to the shape.
shape.TextBody.AddParagraph("Text for moon shape");
//Encrypt the presentation with the combination of alpha and symbol string password.
presentation.Encrypt("MYPASSWORD!@#$%");
//Save the presentation.
presentation.Save("Sample.pptx");
//Close the presentation.
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a new slide of content with caption slide layout type.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.ContentWithCaption)
'Add a auto shape of moon type auto shape.
Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Moon, 50, 0, 200, 200)
'Add a paragraph with text content to the shape.
shape.TextBody.AddParagraph("Text for moon shape")
'Encrypt the presentation with the combination of alpha and symbol string password.
presentation__1.Encrypt("MYPASSWORD!@#$%")
'Save the presentation.
presentation__1.Save("Sample.pptx")
'Close the presentation.
presentation__1.Close()
RemoveEncryption()
Removes the encryption from presentation.
Declaration
void RemoveEncryption()
Examples
//Open the encrypted presentation.
IPresentation presentation = Presentation.Open("Input.pptx", "MYPASSWORD!@#$%");
//Remove the encryption.
presentation.RemoveEncryption();
//Save the presentation.
presentation.Save("Sample.pptx");
//Close the presentation.
presentation.Close();
'Open the encrypted presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Input.pptx", "MYPASSWORD!@#$%")
'Remove the encryption.
presentation__1.RemoveEncryption()
'Save the presentation.
presentation__1.Save("Sample.pptx")
'Close the presentation.
presentation__1.Close()
RemoveMacros()
Removes the macros from the presentation instance.
Declaration
void RemoveMacros()
RemoveWriteProtection()
Removes the write Protection from presentation instance
Declaration
void RemoveWriteProtection()
Examples
//Create an instance for presentation
IPresentation presentation = Presentation.Open("Sample.pptx");
//Check whether the presentation is write protected.
if (presentation.IsWriteProtected)
{
//Removes the write protection from presentation instance
presentation.RemoveWriteProtection();
}
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation.
presentation.Close();
'Create an instance for presentation
Dim presentation As IPresentation = Presentation.Open("Sample.pptx")
'Check whether the presentation is write protected.
if (presentation.IsWriteProtected)
{
//Removes the write protection from presentation instance
presentation.RemoveWriteProtection()
}
'Save the presentation
presentation.Save("Output.pptx")
'Close the presentation.
presentation.Close()
RenderAsImages(ImageFormat)
Converts the presentation slides to images and returns the stream array.
Declaration
Stream[] RenderAsImages(ImageFormat imageFormat)
Parameters
Type | Name | Description |
---|---|---|
ImageFormat | imageFormat | Specifies the image format to convert slides. |
Returns
Type | Description |
---|---|
System.IO.Stream[] | Returns the System.IO.Stream array of the converted images. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a content with caption slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
//Add a table to the slide.
ITable table = slide.Tables.AddTable(5, 5, 0, 0, 500, 500);
//Set the built in table style.
table.BuiltInStyle = BuiltInTableStyle.DarkStyle2Accent3Accent4;
//Iterate through the row collection.
foreach (IRow row in table.Rows)
{
//Iterate through the cell collection.
foreach (ICell cell in row.Cells)
{
//Add a paragraph to the cell.
cell.TextBody.AddParagraph("New Paragraph");
}
}
//Converts the each and every slide in the presentation to image of stream array type.
Stream[] imageStreamArray = presentation.RenderAsImages(Syncfusion.Drawing.ImageFormat.Jpeg);
//Iterate the stream array.
foreach (Stream stream in imageStreamArray)
{
//Save the stream in image of .jpg format.
Image.FromStream(stream).Save("RenderAsImage" + Guid.NewGuid() + ".jpg");
}
//Close the presentation.
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a content with caption slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.ContentWithCaption)
'Add a table to the slide.
Dim table As ITable = slide.Tables.AddTable(5, 5, 0, 0, 500, 500)
'Set the built in table style.
table.BuiltInStyle = BuiltInTableStyle.DarkStyle2Accent3Accent4
'Iterate through the row collection.
For Each row As IRow In table.Rows
'Iterate through the cell collection.
For Each cell As ICell In row.Cells
'Add a paragraph to the cell.
cell.TextBody.AddParagraph("New Paragraph")
Next
Next
'Converts the each and every slide in the presentation to image of stream array type.
Dim imageStreamArray As Stream() = presentation__1.RenderAsImages(Syncfusion.Drawing.ImageFormat.Jpeg)
'Iterate the stream array.
For Each stream As Stream In imageStreamArray
'Save the stream in image of .jpg format.
Image.FromStream(stream).Save("RenderAsImage" + Guid.NewGuid() + ".jpg")
Next
'Close the presentation.
presentation__1.Close()
RenderAsImages(ImageType)
Converts the presentation slides to images and returns the image array.
Declaration
Image[] RenderAsImages(ImageType imageType)
Parameters
Type | Name | Description |
---|---|---|
ImageType | imageType | Specifies the image type to convert slides. |
Returns
Type | Description |
---|---|
System.Drawing.Image[] | Returns the System.Drawing.Image array of the converted images. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a content with caption slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.ContentWithCaption);
//Add a table to the slide.
ITable table = slide.Tables.AddTable(5, 5, 0, 0, 500, 500);
//Set the built in table style.
table.BuiltInStyle = BuiltInTableStyle.DarkStyle2Accent3Accent4;
//Iterate through the row collection.
foreach (IRow row in table.Rows)
{
//Iterate through the cell collection.
foreach (ICell cell in row.Cells)
{
//Add a paragraph to the cell.
cell.TextBody.AddParagraph("New Paragraph");
}
}
//Converts the each and every slide in the presentation to image of System.Drawing.Image type array.
System.Drawing.Image[] imageArray = presentation.RenderAsImages(Syncfusion.Drawing.ImageType.Metafile);
//Iterate the image array.
foreach (System.Drawing.Image image in imageArray)
{
//Save the image of .bmp format.
System.Drawing.image.Save("RenderAsImage" + Guid.NewGuid() + ".bmp");
}
//Close the presentation.
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a content with caption slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.ContentWithCaption)
'Add a table to the slide.
Dim table As ITable = slide.Tables.AddTable(5, 5, 0, 0, 500, 500)
'Set the built in table style.
table.BuiltInStyle = BuiltInTableStyle.DarkStyle2Accent3Accent4
'Iterate through the row collection.
For Each row As IRow In table.Rows
'Iterate through the cell collection.
For Each cell As ICell In row.Cells
'Add a paragraph to the cell.
cell.TextBody.AddParagraph("New Paragraph")
Next
Next
'Converts the each and every slide in the presentation to image of System.Drawing.Image type array.
Dim imageArray As Image() = presentation__1.RenderAsImages(Syncfusion.Drawing.ImageType.Metafile)
'Iterate the image array.
For Each image As Image In imageArray
'Save the image of .bmp format.
image.Save("RenderAsImage" + Guid.NewGuid() + ".bmp")
Next
'Close the presentation.
presentation__1.Close()
Save(Stream)
Declaration
void Save(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Remarks
At present, the Essential Presentation library only supports the PPTX file format.
Examples
//Create instance for memory stream
MemoryStream fileStream = new MemoryStream();
//Open a presentation
IPresentation presentation = Presentation.Create();
//Save the presentation using stream
presentation.Save(fileStream);
//Close the presentation.
presentation.Close();
//Dispose the file stream
fileStream.Dispose();
'Create instance for memory stream
Dim fileStream As New MemoryStream()
'Open a presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Save the presentation using stream
presentation__1.Save(fileStream)
'Close the presentation.
presentation__1.Close()
'Dispose the file stream
fileStream.Dispose()
Save(String)
Saves the presentation to the specified file name.
Declaration
void Save(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Specifies the file name to save the presentation. |
Remarks
At present, the Essential Presentation library only supports the PPTX file format.
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(3, 3, 100, 120, 300, 200);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(3, 3, 100, 120, 300, 200)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Save(String, FormatType, HttpResponse)
Saves the presentation to the specified HttpResponse instance.
Declaration
void Save(string fileName, FormatType formatType, HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | The name of the file in HttpResponse. |
FormatType | formatType | The format type of the presentation. |
System.Web.HttpResponse | response | The HttpResponse to save the presentation. |
Remarks
At present, the Essential Presentation library only supports the PPTX file format.
Examples
//Create a presentation
IPresentation presentation = Presentation.Create();
//Save the presentation to the specified HttpResponse
presentation.Save("Sample.pptx", FormatType.Pptx, HttpContext.Current.Response);
'Create a presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Save the presentation to the specified HttpResponse
presentation__1.Save("Sample.pptx", FormatType.Pptx, Response)
SetWriteProtection(String)
Sets the write protection for the presentation instance
Declaration
void SetWriteProtection(string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | password | Password to enforce protection. |
Remarks
Maximum length of password should be 15. If it exceeds 15, first 15 characters will be considered for protection, remaining will be ignored.
Examples
//Create an instance for presentation
IPresentation presentation = Presentation.Create();
//Add a new slide of comparison slide layout type.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Comparison);
//Add an auto shape of regular pentagon auto shape type.
slide.Shapes.AddShape(AutoShapeType.RegularPentagon, 10, 20, 300, 400);
//Set the write protection for Presentation instance with password.
presentation.SetWriteProtection("MYPASSWORD");
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation.
presentation.Close();
'Create an instance for presentation
Dim presentation As IPresentation = Presentation.Create()
'Add a new slide of comparison slide layout type.
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Comparison)
'Add an auto shape of regular pentagon auto shape type.
slide.Shapes.AddShape(AutoShapeType.RegularPentagon, 10, 20, 300, 400)
'Set the write protection for Presentation instance with password.
presentation.SetWriteProtection("MYPASSWORD")
'Save the presentation
presentation.Save("Sample.pptx")
'Close the presentation.
presentation.Close()