From 0d6ffcb237381b0ebd77e0161f7fd12a9b0f735d Mon Sep 17 00:00:00 2001 From: Viswajith-SF4658 Date: Wed, 29 Jul 2026 20:54:22 +0530 Subject: [PATCH] Task 1044136: Revamp User Guide Documentation in PowerPoint presentation library - Phase 2 --- .../PowerPoint/PowerPoint-Library/NET/FAQ.md | 42 +- .../PowerPoint-Library/NET/Feature-Matrix.md | 67 ++- .../PowerPoint-Library/NET/Security.md | 271 ++++----- .../PowerPoint-Library/NET/SmartArt.md | 176 +++--- .../NET/Supported-and-Unsupported-Features.md | 27 +- .../NET/Working-with-Hyperlinks.md | 541 +++++++++--------- .../NET/Working-with-Macros.md | 91 +-- .../NET/Working-with-NotesSlide.md | 115 ++-- .../NET/Working-with-OLE-Objects.md | 256 +++++---- .../NET/Working-with-headers-and-footers.md | 255 ++++----- .../NET/Working-with-sections.md | 183 +++--- ...nnectors-in-powerpoint-slides-cs-vb-net.md | 59 +- ...owerpoint-presentation-slides-cs-vb-net.md | 88 +-- .../migrate-from-net-framework-to-net-core.md | 91 +-- ...ltithreading-in-powerpoint-library-faqs.md | 24 +- 15 files changed, 1175 insertions(+), 1111 deletions(-) diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/FAQ.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/FAQ.md index d2ef1bd163..73e347e8c1 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/FAQ.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/FAQ.md @@ -9,27 +9,27 @@ documentation: UG The frequently asked questions in Essential® PowerPoint Presentations are listed below. -## Why I get an exception when trying to load a PPT file? +## Why do I get an exception when trying to load a PPT file? -The current version of Presentation library supports only .PPTX format - Microsoft Office 2007 and later version. +The current version of the Presentation library supports only the .pptx format (Microsoft Office 2007 and later versions). ## Is it possible to print the Presentation slides? -Yes, you can print the PowerPoint presentations by using its ability to convert the slides as images and by using the [PrintDocument](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printdocument?redirectedfrom=MSDN&view=dotnet-plat-ext-7.0# "") class. For more details, refer to [Printing](http://www.google.com/# "") +Yes, you can print PowerPoint presentations by converting the slides to images and using the [PrintDocument](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.printing.printdocument?view=net-11.0-pp) class. For more details, refer to the [Printing](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image) documentation. -## Does adding audio and video to a Presentation is supported? +## Is adding audio and video to a Presentation supported? -At present, there is no support to add audio and video to Presentation by using Essential® Presentation library. +No, the current version of the Essential® Presentation library does not support adding audio and video to a Presentation. For feature requests, contact Syncfusion support. -## What measure does Essential® Presentation use to add slide elements such as textbox, shape, picture and charts? +## What unit of measurement does Essential® Presentation use to add slide elements such as text box, shape, picture, and chart? -We use Points to add any slide elements in a Presentation. +Essential® Presentation uses **points** as the unit of measurement when adding slide elements such as text boxes, shapes, pictures, and charts. -## Does Essential® Presentation supports cloning a slide in the Presentation? +## Does Essential® Presentation support cloning a slide in the Presentation? Yes, Essential® Presentation library supports cloning as follows: - * Slide in the Presentation can be cloned from one Presentation to another or within a same Presentation. + * A slide in the Presentation can be cloned from one Presentation to another, or within the same Presentation. * An entire Presentation can also be cloned as an independent copy of the original. ## Could not find Syncfusion.OfficeChartToImageConverter assembly in .NET 3.5 Framework, does it mean there is no support for chart conversion in this framework? @@ -38,19 +38,19 @@ Yes, OfficeChartToImageConverter assembly is not supported in .NET 3.5 Framework ## Can chart data be refreshed? -Yes, Essential® Presentation supports refreshing the chart data. For more details, refer to [Working with charts](/document-processing/powerpoint/powerpoint-library/net/working-with-charts) +Yes, Essential® Presentation supports refreshing the chart data. For more details, refer to [Working with charts](/document-processing/powerpoint/powerpoint-library/net/working-with-charts). ## Is it possible to convert 3D charts to PDF or image? -Current version of the Essential® Presentation library does not provide support for converting 3D charts to PDF or image format. +No, the current version of the Essential® Presentation library does not support converting 3D charts to PDF or image format. -## How to improve the image quality while converting the Presentation slides to image? +## How do I improve the image quality when converting Presentation slides to images? -You can improve the quality of converted images by specifying the image resolution. Refer – [Converting PowerPoint presentation to Images](/document-processing/powerpoint/powerpoint-library/net/getting-started#converting-powerpoint-presentation-to-images) +You can improve the quality of converted images by specifying the image resolution (DPI). Refer to [Converting PowerPoint presentation to Images](/document-processing/powerpoint/powerpoint-library/net/getting-started#converting-powerpoint-presentation-to-images). -## What are the NuGet packages to be installed to perform PowerPoint Presentation to PDF conversion in Linux OS? +## What are the NuGet packages required to perform PowerPoint Presentation to PDF conversion in Linux OS? -In Linux OS, perform PowerPoint presentation to PDF conversion using the .NET Core (Targeting .netcoreapp) application. Refer to [PowerPoint presentation to PDF conversion NuGet packages](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/nuget-packages-required#converting-powerpoint-presentation-into-pdf) to know about the packages required to deploy the .NET Core (Targeting .netcoreapp) applications with PowerPoint presentation to PDF conversion capabilities. +On Linux OS, perform PowerPoint presentation to PDF conversion using a .NET Core (Targeting .netcoreapp) application. Refer to [PowerPoint presentation to PDF conversion NuGet packages](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/nuget-packages-required#converting-powerpoint-presentation-into-pdf) for the base Syncfusion PowerPoint NuGet packages required to deploy the .NET Core application with PDF conversion capabilities. In addition to the previous NuGet packages, your application needs to install the following NuGet packages. @@ -58,7 +58,7 @@ In addition to the previous NuGet packages, your application needs to install th -Version +Syncfusion Version NuGet packages to install @@ -150,11 +150,11 @@ Install the SkiaSharp.Linux NuGet package for the .NET Core application in Linux * [Does the PowerPoint library support multithreading and thread-safety?](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/faqs/multithreading-powerpoint-reading-faqs#does-the-powerpoint-library-support-multithreading-and-thread-safety) -## Does PPTX file support sensitivity labels? -No, Presentation library processes the file-level information of PowerPoint. Sensitivity labels are organization-level settings and are not stored within the PPTX file itself. As a result, the Presentation library does not support set or get or preserve sensitivity labels. +## Does a PPTX file support sensitivity labels? +No. The Presentation library processes the file-level information of a PowerPoint file. Sensitivity labels are organization-level settings applied through Microsoft Purview and are not stored within the PPTX file itself. As a result, the Presentation library does not support setting, getting, or preserving sensitivity labels. For background, see [Microsoft sensitivity labels overview](https://learn.microsoft.com/en-us/purview/sensitivity-labels). -## Can Presentation library Open a PPTX file with Sensitivity Labels Applied? -If a PPTX file is encrypted due to its sensitivity label configuration, Presentation library cannot open it because the content is stored in an encrypted format and requires an authorized Microsoft account for access. +## Can the Presentation library open a PPTX file with sensitivity labels applied? +If a PPTX file is encrypted due to its sensitivity label configuration, the Presentation library cannot open it because the content is stored in an encrypted format and requires an authorized Microsoft account for access. To detect this case before calling `Open`, wrap the call in a try/catch and handle the file-format/encryption exception, or remove the sensitivity label in Microsoft PowerPoint before opening. ## Does the PowerPoint library support asynchronous methods to open or save a presentation? -No, the Syncfusion PowerPoint library does not provide asynchronous APIs for opening or saving presentations. However, the library is highly optimized for performance and is thread‑safe, allowing you to perform presentation processing operations. +No, the Syncfusion PowerPoint library does not provide asynchronous APIs for opening or saving presentations. However, the library is highly optimized for performance and is thread-safe, allowing you to perform presentation-processing operations off the UI thread. diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Feature-Matrix.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Feature-Matrix.md index 2a6cc4a366..7bed1e46c3 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Feature-Matrix.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Feature-Matrix.md @@ -1,6 +1,6 @@ --- title: Feature Matrix in .NET PowerPoint Library | Syncfusion -description: Explore the supported features of Syncfusion® Essential PowerPoint for working with PowerPoint 2007–2016 presentations programmatically. +description: Explore the supported features of Syncfusion® Essential PowerPoint for working with PowerPoint 2007–2016 and later OOXML presentations programmatically. platform: document-processing control: Presentation documentation: UG @@ -8,41 +8,38 @@ documentation: UG # Feature Matrix in .NET PowerPoint Library -Syncfusion® Essential PowerPoint is a [.NET PowerPoint library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) that provides comprehensive support for creating, editing, and managing PowerPoint presentations programmatically. It allows seamless handling of slides, shapes, charts, SmartArt, tables, and more. +Syncfusion® Essential PowerPoint is the [.NET PowerPoint library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) that provides comprehensive support for creating, editing, and managing PowerPoint presentations programmatically. It allows seamless handling of features such as slides, shapes, charts, SmartArt, and tables. -The following table outlines the supported features for PowerPoint 2007–2016 presentations. +For prerequisites and setup, refer to the [Assemblies Required](Assemblies-Required.md) and [NuGet Packages Required](NuGet-Packages-Required) pages. For a quick start, see the [Getting Started](Getting-Started) guide. + +The following table outlines the supported features for PowerPoint 2007–2016 and later OOXML presentations. ## Document Content Features - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- {{'**Document Content Features**'| markdownify }} - - {{'**PowerPoint 2007–2016**'| markdownify }} -
Create PowerPoint presentations from scratch or edit an existing presentation. Yes
Open existing PowerPoint presentations from the file system or stream. Yes
Save PowerPoint presentation to a local file, stream, or stream it to a client browser. Yes
Create, access, and modify paragraphs and text. Yes
Create, access, and modify bullets and numbering. Yes
Create, access, and modify images. Yes
Create, access, and modify tables, rows, and cells. Yes
Create, access, and modify shapes. Yes
Create, access, and modify charts. Yes
Access and modify placeholders. Yes
Create, access, and modify SmartArt diagrams. Yes
Create, access, and modify sections. Yes
Create, access, and modify animation and slide transition. Yes
Create, access, and modify hyperlinks. Yes
Create, access, and modify slide notes. Yes
Copy and move slide elements between PowerPoint presentations. Yes
Merge multiple PowerPoint presentations. Yes
Encrypt and open password-protected PowerPoint presentations. Yes
Iterate over slide content. Yes
Insert OLE objects in PowerPoint presentations. Yes
Access and modify built-in document properties. Yes
Create, access, and modify custom document properties. Yes
+| Document Content Features | PowerPoint 2007–2016 and later | +| --- | :---: | +| Create PowerPoint presentations from scratch or edit an existing presentation. | Yes | +| Open existing PowerPoint presentations from the file system or stream. | Yes | +| Save a PowerPoint presentation to a local file, stream, or stream it to a client browser. | Yes | +| Create, access, and modify paragraphs and text. | Yes | +| Create, access, and modify bullets and numbering. | Yes | +| Create, access, and modify images. | Yes | +| Create, access, and modify tables, rows, and cells. | Yes | +| Create, access, and modify shapes. | Yes | +| Create, access, and modify charts. | Yes | +| Create, access, and modify placeholders. | Yes | +| Create, access, and modify SmartArt diagrams. | Yes | +| Create, access, and modify sections. | Yes | +| Create, access, and modify animations. | Yes | +| Create, access, and modify slide transitions. | Yes | +| Create, access, and modify hyperlinks. | Yes | +| Create, access, and modify slide notes. | Yes | +| Copy and move slide elements between PowerPoint presentations. | Yes | +| Merge multiple PowerPoint presentations. | Yes | +| Encrypt and open password-protected PowerPoint presentations. | Yes | +| Traverse slide content programmatically. | Yes | +| Insert OLE objects in PowerPoint presentations. | Yes | +| Create, access, and modify built-in document properties. | Yes | +| Create, access, and modify custom document properties. | Yes | + + diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Security.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Security.md index 0d5cf797a7..96bfac2c9a 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Security.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Security.md @@ -10,28 +10,22 @@ documentation: UG To quickly start protecting PowerPoint presentations, please check out this video: {% youtube "https://www.youtube.com/watch?v=GnnVPtrP9rE" %} -## Encrypting with password +## Encrypting with password -You can protect a PowerPoint Presentation by encrypting the document by using a password. This prevents unauthorized users to access or make changes in the Presentation. +You can protect a PowerPoint presentation by encrypting the document using a password. This prevents unauthorized users from accessing or making changes to the presentation. The input file (for example, `Template.pptx`) must already exist in the working directory. -The following code example demonstrates how to encrypt a PowerPoint Presentation with password. +The following code example demonstrates how to encrypt a PowerPoint presentation with a password. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Security/Encrypt-PowerPoint-with-password/.NET/Encrypt-PowerPoint-with-password/Program.cs" %} //Open an existing presentation. -using (FileStream inputStream = new FileStream("Template.pptx", FileMode.Open, FileAccess.Read)) +using (IPresentation presentation = Presentation.Open("Template.pptx")) { - using (IPresentation presentation = Presentation.Open(inputStream)) - { - //Encrypt the presentation with a password. - presentation.Encrypt("syncfusion"); - //Saves the Presentation. - using (FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create)) - { - presentation.Save(outputStream); - } - } + //Encrypt the presentation with a password. + presentation.Encrypt("syncfusion"); + //Saves the presentation. + presentation.Save("Sample.pptx"); } {% endhighlight %} @@ -64,72 +58,59 @@ You can download a complete working sample from [GitHub](https://github.com/Sync Essential® Presentation provides ability to remove the encryption from the PowerPoint Presentation. You can decrypt a PowerPoint Presentation by opening it with the password. -**Opening** **the** **Encrypted** **PowerPoint** **Presentation** +### Opening an Encrypted PowerPoint Presentation -The following code example demonstrates opening the encrypted PowerPoint Presentation. +The following code example demonstrates opening an encrypted PowerPoint presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} -//Opens an existing Presentation from file system and it can be decrypted by using the provided password. -using (FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open)) +//Opens an existing presentation from the file system and decrypts it using the provided password. +using (IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")) { - using (IPresentation presentation = Presentation.Open(inputStream, "PASSWORD!@1#$")) - { - //Save the PowerPoint Presentation as stream. - using (FileStream outputStream = new FileStream("Output.pptx", FileMode.Create)) - { - presentation.Save(outputStream); - } - } + //Saves the presentation. + presentation.Save("Output.pptx"); } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens an existing Presentation from file system and it can be decrypted by using the provided password. +//Opens an existing presentation from the file system and decrypts it using the provided password. using (IPresentation presentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$")) { - //Saves the Presentation. + //Saves the presentation. presentation.Save("Output.pptx"); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens an existing Presentation from file system and it can be decrypted by using the provided password. +'Opens an existing presentation from the file system and decrypts it using the provided password. Using presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "PASSWORD!@1#$") - 'Saves the Presentation + 'Saves the presentation. presentationDocument.Save("Output.pptx") End Using {% endhighlight %} {% endtabs %} -**Removing the encryption from Presentation** +### Removing the Encryption from a Presentation -The following code example demonstrates removing the encryption from a PowerPoint Presentation. +The following code example demonstrates removing encryption from a PowerPoint presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Security/Remove-encryption/.NET/Remove-encryption/Program.cs" %} -//Opens an existing Presentation from file system and it can be decrypted by using the provided password. -using (FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open)) +//Opens an existing presentation from the file system and decrypts it using the provided password. +using (IPresentation presentation = Presentation.Open("Sample.pptx", "syncfusion")) { - //Opens an existing Presentation from file system and it can be decrypted by using the provided password. - using (IPresentation presentation = Presentation.Open(inputStream, "syncfusion")) - { - //Decrypts the document. - presentation.RemoveEncryption(); - //Save the PowerPoint Presentation as stream. - using (FileStream outputStream = new FileStream("Output.pptx", FileMode.Create)) - { - presentation.Save(outputStream); - } - } + //Decrypts the document. + presentation.RemoveEncryption(); + //Saves the presentation. + presentation.Save("Output.pptx"); } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens an existing Presentation from file system and it can be decrypted by using the provided password. +//Opens an existing presentation from the file system and decrypts it using the provided password. using (IPresentation presentation = Presentation.Open("Sample.pptx", "syncfusion")) { //Decrypts the document. @@ -140,11 +121,11 @@ using (IPresentation presentation = Presentation.Open("Sample.pptx", "syncfusion {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens an existing Presentation from file system and it can be decrypted by using the provided password. +'Opens an existing presentation from the file system and decrypts it using the provided password. Using presentationDocument As IPresentation = Presentation.Open("Sample.pptx", "syncfusion") 'Decrypts the document. presentationDocument.RemoveEncryption() - 'Saves the Presentation. + 'Saves the presentation. presentationDocument.Save("Output.pptx") End Using {% endhighlight %} @@ -155,147 +136,141 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Write Protection -You can set write protection for a PowerPoint Presentation and remove protection from the write protected PowerPoint presentation. +You can set write protection for a PowerPoint presentation and remove the protection from a write-protected PowerPoint presentation. -### Protect PowerPoint Presentation +### Setting Write Protection -You can protect a PowerPoint Presentation with password to restrict unauthorized editing. +You can protect a PowerPoint presentation with a password to restrict unauthorized editing. -The following code example shows how to set write protection for a PowerPoint Presentation. +The following code example shows how to set write protection for a PowerPoint presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Security/Set-write-protection/.NET/Set-write-protection/Program.cs" %} -//Create a new instance for PowerPoint presentation -IPresentation pptxDoc = Presentation.Create(); -//Add the blank slide to the presentation -ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Add the shape to the slide -IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200); -//Add the paragraph to the shape. -IParagraph paragraph = shape.TextBody.AddParagraph("welcome"); -//Sets the author name -pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion"; -//Set the write protection for presentation instance -pptxDoc.SetWriteProtection("MYPASSWORD"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Output.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Closes the presentation -pptxDoc.Close(); +//Create a new instance for the PowerPoint presentation. +using (IPresentation pptxDoc = Presentation.Create()) +{ + //Add a blank slide to the presentation. + ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); + //Add a shape to the slide. + IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200); + //Add a paragraph to the shape. + IParagraph paragraph = shape.TextBody.AddParagraph("welcome"); + //Set the author name. + pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion"; + //Set the write protection for the presentation instance. + pptxDoc.SetWriteProtection("MYPASSWORD"); + //Saves the presentation. + pptxDoc.Save("Sample.pptx"); +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Create a new instance for PowerPoint presentation -IPresentation pptxDoc = Presentation.Create(); -//Add the blank slide to the presentation -ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Add the shape to the slide -IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200); -//Add the paragraph to the shape. -IParagraph paragraph = shape.TextBody.AddParagraph("welcome"); -//Sets the author name -pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion"; -//Set the write protection for presentation instance -pptxDoc.SetWriteProtection("MYPASSWORD"); -//Saves the modified cloned PowerPoint presentation -pptxDoc.Save("Sample.pptx"); -//Close the presentation instance -pptxDoc.Close(); +//Create a new instance for the PowerPoint presentation. +using (IPresentation pptxDoc = Presentation.Create()) +{ + //Add a blank slide to the presentation. + ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); + //Add a shape to the slide. + IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200); + //Add a paragraph to the shape. + IParagraph paragraph = shape.TextBody.AddParagraph("welcome"); + //Set the author name. + pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion"; + //Set the write protection for the presentation instance. + pptxDoc.SetWriteProtection("MYPASSWORD"); + //Saves the presentation. + pptxDoc.Save("Sample.pptx"); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Create a new instance for PowerPoint presentation -IPresentation pptxDoc = Presentation.Create() -'Add the blank slide to the presentation -ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Add the shape to the slide -IShape shape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200) -'Add the paragraph to the shape. -IParagraph paragraph = shape.TextBody.AddParagraph("welcome") -'Sets the author name -pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion" -'Set the write protection for presentation instance -pptxDoc.SetWriteProtection("MYPASSWORD") -'Saves the modified cloned PowerPoint presentation -pptxDoc.Save("Sample.pptx") -'Close the presentation instance -pptxDoc.Close() +'Create a new instance for the PowerPoint presentation. +Using pptxDoc As IPresentation = Presentation.Create() + 'Add a blank slide to the presentation. + Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) + 'Add a shape to the slide. + Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.BlockArc, 0, 0, 200, 200) + 'Add a paragraph to the shape. + Dim paragraph As IParagraph = shape.TextBody.AddParagraph("welcome") + 'Set the author name. + pptxDoc.BuiltInDocumentProperties.Author = "Syncfusion" + 'Set the write protection for the presentation instance. + pptxDoc.SetWriteProtection("MYPASSWORD") + 'Saves the presentation. + pptxDoc.Save("Sample.pptx") +End Using {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Security/Set-write-protection). -### Remove Protection +### Removing Write Protection -You can check whether a PowerPoint Presentation is write protected and remove protection from the write protected PowerPoint Presentation. +You can check whether a PowerPoint presentation is write protected and remove the protection. The `IsWriteProtected` property returns `true` when the presentation is read-only due to write protection. -The following code example shows how to remove restriction protection from the write protected PowerPoint Presentation +The following code example shows how to remove write protection from a PowerPoint presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Security/Remove-write-protection/.NET/Remove-write-protection/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets whether the presentation is write Protected. Read - only. -bool writeProtected = pptxDoc.IsWriteProtected; -//Checks whether the presentation is write protected -if (writeProtected) +//Open the PowerPoint presentation. +using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) { - //Removes the write protection for presentation instance. - pptxDoc.RemoveWriteProtection(); + //Gets whether the presentation is write protected (read-only). + bool writeProtected = pptxDoc.IsWriteProtected; + //Check whether the presentation is write protected. + if (writeProtected) + { + //Removes the write protection for the presentation instance. + pptxDoc.RemoveWriteProtection(); + } + //Saves the presentation. + pptxDoc.Save("Output.pptx"); } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Output.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Closes the presentation -pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open the PowerPoint presentation -IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Gets whether the presentation is write Protected. Read - only. -bool writeProtected = pptxDoc.IsWriteProtected; -//Checks whether the presentation is write protected -if (writeProtected) +//Open the PowerPoint presentation. +using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) { - //Removes the write protection for presentation instance. - pptxDoc.RemoveWriteProtection(); + //Gets whether the presentation is write protected (read-only). + bool writeProtected = pptxDoc.IsWriteProtected; + //Check whether the presentation is write protected. + if (writeProtected) + { + //Removes the write protection for the presentation instance. + pptxDoc.RemoveWriteProtection(); + } + //Saves the presentation. + pptxDoc.Save("Output.pptx"); } -//Saves the modified cloned PowerPoint presentation -pptxDoc.Save("Output.pptx"); -//Close the presentation instance -pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open the PowerPoint presentation -IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -'Gets whether the presentation is write Protected. Read - only. -bool writeProtected = pptxDoc.IsWriteProtected; -'Checks whether the presentation is write protected -if (writeProtected) -{ - 'Removes the write protection for presentation instance. - pptxDoc.RemoveWriteProtection(); -} -'Saves the modified cloned PowerPoint presentation -pptxDoc.Save("Output.pptx") -'Close the presentation instance -pptxDoc.Close() +'Open the PowerPoint presentation. +Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx") + 'Gets whether the presentation is write protected (read-only). + Dim writeProtected As Boolean = pptxDoc.IsWriteProtected + 'Check whether the presentation is write protected. + If writeProtected Then + 'Removes the write protection for the presentation instance. + pptxDoc.RemoveWriteProtection() + End If + 'Saves the presentation. + pptxDoc.Save("Output.pptx") +End Using {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Security/Remove-write-protection). -N> 1. In Xamarin applications, Encryption, Decryption and Write Protection features are supported from the target framework .NET Standard 2.0 version onwards. -N> 2. For ASP.NET Core, Encryption, Decryption and Write Protection features are supported from the .NET Core 2.0 version onwards. +N> 1. In Xamarin applications, encryption, decryption, and write protection are supported in .NET Standard 2.0 and later. +N> 2. In ASP.NET Core, encryption, decryption, and write protection are supported in .NET Core 2.0 and later. ## Online Demo -* Explore how to set write protection for a PowerPoint presentation with a password using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/writeprotection#/tailwind). -* See how to encrypt and decrypt the PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/encryptanddecrypt#/tailwind). \ No newline at end of file +* Learn how to set write protection for a PowerPoint presentation with a password using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/writeprotection#/tailwind). +* See how to encrypt and decrypt a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/encryptanddecrypt#/tailwind). \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/SmartArt.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/SmartArt.md index 685514ced5..0364a9317d 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/SmartArt.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/SmartArt.md @@ -1,11 +1,11 @@ --- title: Working with SmartArt in PowerPoint Presentation | Syncfusion -description: Learn how to create, edit, and format PowerPoint smartArt in C# using .NET PowerPoint library without Microsoft PowerPoint or interop dependencies. +description: Learn how to create, edit, and format SmartArt diagrams in PowerPoint presentations using the Syncfusion .NET PowerPoint library without Microsoft PowerPoint or interop dependencies. platform: document-processing control: Presentation documentation: UG --- -# Working with PowerPoint SmartArt +# Working with SmartArt in PowerPoint Presentation A [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagram is a visual representation of your information, to effectively communicate your ideas in presentations. You can add and modify the [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagrams in PowerPoint presentations using Essential® Presentation library. @@ -14,7 +14,7 @@ To quickly start creating a SmartArt in a PowerPoint Presentation using .NET Pow ## Adding SmartArt to a Slide -You can add any of the predefined [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagrams to PowerPoint Presentation. The following code example demonstrates adding a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) to a Slide. +You can add any of the predefined [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagrams to PowerPoint Presentation. The following code example demonstrates adding a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) to a slide. {% tabs %} @@ -23,11 +23,10 @@ You can add any of the predefined [SmartArt](https://help.syncfusion.com/cr/docu IPresentation pptxDoc = Presentation.Create(); //Add a blank slide to the Presentation ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Add a BasicBlockList SmartArt to the slide at the specified size and position. -ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Add a BasicBlockList SmartArt to the slide at the specified size and position (x, y, width, height in points). +ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation pptxDoc.Close(); {% endhighlight %} @@ -38,7 +37,7 @@ IPresentation pptxDoc = Presentation.Create(); //Add a blank slide to the Presentation ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a BasicBlockList SmartArt to the slide at the specified size and position. -ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426); +ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426); //Save the Presentation pptxDoc.Save("SmartArt.pptx"); //Close the Presentation @@ -66,6 +65,8 @@ You can download a complete working sample from [GitHub](https://github.com/Sync You can add a new node to the [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagram. The following code example demonstrates the same. +For information about identifying whether a node is an assistant node, see [Assistant nodes in SmartArt](#assistant-nodes-in-smartart). + {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/SmartArts/Add-SmartArt-node/.NET/Add-SmartArt-node/Program.cs" %} @@ -75,13 +76,12 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a SmartArt to the slide at the specified size and position ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426); -// Add a new node to the SmartArt. +//Add a new node to the SmartArt. ISmartArtNode newNode = smartArt.Nodes.Add(); -// Set the text to the newly added node. +//Set the text of the newly added node. newNode.TextBody.AddParagraph("New main node added."); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} @@ -93,9 +93,9 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a SmartArt to the slide at the specified size and position ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426); -// Add a new node to the SmartArt. +//Add a new node to the SmartArt. ISmartArtNode newNode = smartArt.Nodes.Add(); -// Set the text to the newly added node. +//Set the text of the newly added node. newNode.TextBody.AddParagraph("New main node added."); //Save the Presentation. pptxDoc.Save("SmartArt.pptx"); @@ -112,7 +112,7 @@ Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426) 'Add a new node to the SmartArt. Dim newNode As ISmartArtNode = smartArt.Nodes.Add() -'Set the text to the newly added node. +'Set the text of the newly added node. newNode.TextBody.AddParagraph("New main node added.") 'Save the Presentation. pptxDoc.Save("SmartArt.pptx") @@ -125,7 +125,7 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/SmartArts/Add-SmartArt-node). -In [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagrams, you can also add nodes to several nested levels. The maximum limit of nested levels may vary based on SmartArt types. The following code example demonstrates adding nested level nodes in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html). +In [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) diagrams, you can also add nodes to several nested levels. The maximum number of nested levels varies by SmartArt type. The following code example demonstrates adding nested level nodes in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html). {% tabs %} @@ -136,15 +136,14 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a SmartArt to the slide at the specified size and position. ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426); -// Add a new node to the SmartArt. +//Add a new node to the SmartArt. ISmartArtNode newNode = smartArt.Nodes.Add(); -// Add a child node to the SmartArt node +//Add a child node to the SmartArt node ISmartArtNode childNode = newNode.ChildNodes.Add(); -// Set a text to newly added child node. +//Set the text of the newly added child node. childNode.TextBody.AddParagraph("Child node of the existing node."); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} @@ -156,11 +155,11 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a SmartArt to the slide at the specified size and position. ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426); -// Add a new node to the SmartArt. +//Add a new node to the SmartArt. ISmartArtNode newNode = smartArt.Nodes.Add(); -// Add a child node to the SmartArt node +//Add a child node to the SmartArt node ISmartArtNode childNode = newNode.ChildNodes.Add(); -// Set a text to newly added child node. +//Set the text of the newly added child node. childNode.TextBody.AddParagraph("Child node of the existing node."); //Save the Presentation. pptxDoc.Save("SmartArt.pptx"); @@ -179,7 +178,7 @@ Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHex Dim newNode As ISmartArtNode = smartArt.Nodes.Add() 'Add a child node to the SmartArt node Dim childNode As ISmartArtNode = newNode.ChildNodes.Add() -'Set a text to newly added child node. +'Set the text of the newly added child node. childNode.TextBody.AddParagraph("Child node of the existing node.") 'Save the Presentation. pptxDoc.Save("SmartArt.pptx") @@ -193,49 +192,47 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Modifying SmartArt appearance -You can modify the [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) appearance by modifying the fill type, color, transparency etc. The below code example demonstrates modifying the appearance of [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) nodes. +You can modify the [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) appearance by modifying the fill type, color, transparency, and so on. The following code example demonstrates modifying the appearance of [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) nodes. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/SmartArts/Modify-SmartArt-appearance/.NET/Modify-SmartArt-appearance/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); //Get the Slide from Presentation ISlide slide = pptxDoc.Slides[0]; //Get the SmartArt from Slide. ISmartArt smartArt = slide.Shapes[0] as ISmartArt; //Get the first node ISmartArtNode firstNode = smartArt.Nodes[0]; -// Set the text content of node. +//Set the text content of the node. firstNode.TextBody.AddParagraph("First Node"); -//Set the fill type of node. +//Set the fill type of the node. firstNode.Shapes[0].Fill.FillType = FillType.Solid; -// Set the fill color of node. +//Set the fill color of the node. firstNode.Shapes[0].Fill.SolidFill.Color = ColorObject.GreenYellow; //Set transparency value of fill firstNode.Shapes[0].Fill.SolidFill.Transparency = 30; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Open a PowerPoint Presentation -IPresentation pptxDoc = Presentation.Open("SampleDocument.pptx"); +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); //Get the Slide from Presentation ISlide slide = pptxDoc.Slides[0]; //Get the SmartArt from Slide. ISmartArt smartArt = slide.Shapes[0] as ISmartArt; //Get the first node ISmartArtNode firstNode = smartArt.Nodes[0]; -// Set the text content of node. +//Set the text content of the node. firstNode.TextBody.AddParagraph("First Node"); -//Set the fill type of node. +//Set the fill type of the node. firstNode.Shapes[0].Fill.FillType = FillType.Solid; -// Set the fill color of node. +//Set the fill color of the node. firstNode.Shapes[0].Fill.SolidFill.Color = ColorObject.GreenYellow; //Set transparency value of fill firstNode.Shapes[0].Fill.SolidFill.Transparency = 30; @@ -247,18 +244,18 @@ pptxDoc.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Open a PowerPoint Presentation -Dim pptxDoc As IPresentation = Presentation.Open("SampleDocument.pptx") +Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") 'Get the Slide from Presentation Dim slide As ISlide = pptxDoc.Slides(0) 'Get the SmartArt from Slide. Dim smartArt As ISmartArt = TryCast(slide.Shapes(0), ISmartArt) 'Get the first node Dim firstNode As ISmartArtNode = smartArt.Nodes(0) -' Set the text content of node. +'Set the text content of the node. firstNode.TextBody.AddParagraph("First Node") -'Set the fill type of node. +'Set the fill type of the node. firstNode.Shapes(0).Fill.FillType = FillType.Solid -' Set the fill color of node. +'Set the fill color of the node. firstNode.Shapes(0).Fill.SolidFill.Color = ColorObject.GreenYellow 'Set transparency value of fill firstNode.Shapes(0).Fill.SolidFill.Transparency = 30 @@ -274,15 +271,15 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Iterating through child nodes of an existing SmartArt -You can iterate through the child nodes and access the properties of each node in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html). The following code example demonstrates accessing and modifying the text content of node. +You can iterate through the child nodes and access the properties of each node in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html). The following code example demonstrates accessing and modifying the text content of a node. + {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/SmartArts/Iterate-child-nodes-of-existing-SmartArt/.NET/Iterate-child-nodes-of-existing-SmartArt/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Traverse through shape in the first slide. +//Open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Traverse through shapes in the first slide. foreach (IShape shape in pptxDoc.Slides[0].Shapes) { if (shape is ISmartArt) @@ -291,22 +288,23 @@ foreach (IShape shape in pptxDoc.Slides[0].Shapes) foreach (ISmartArtNode mainNode in (shape as ISmartArt).Nodes) { if (mainNode.TextBody.Text == "Old Content") - //Change the node content - mainNode.TextBody.Paragraphs[0].TextParts[0].Text = "New Content"; + { + //Change the node content + mainNode.TextBody.Paragraphs[0].TextParts[0].Text = "New Content"; + } } } } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Open a PowerPoint Presentation -IPresentation pptxDoc = Presentation.Open("SampleDocument.pptx"); -//Traverse through shape in the first slide. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Traverse through shapes in the first slide. foreach (IShape shape in pptxDoc.Slides[0].Shapes) { if (shape is ISmartArt) @@ -315,8 +313,10 @@ foreach (IShape shape in pptxDoc.Slides[0].Shapes) foreach (ISmartArtNode mainNode in (shape as ISmartArt).Nodes) { if (mainNode.TextBody.Text == "Old Content") - //Change the node content - mainNode.TextBody.Paragraphs[0].TextParts[0].Text = "New Content"; + { + //Change the node content + mainNode.TextBody.Paragraphs[0].TextParts[0].Text = "New Content"; + } } } } @@ -328,8 +328,8 @@ pptxDoc.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Open a PowerPoint Presentation -Dim pptxDoc As IPresentation = Presentation.Open("SampleDocument.pptx") -'Traverse through shape in the first slide. +Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") +'Traverse through shapes in the first slide. For Each shape As IShape In pptxDoc.Slides(0).Shapes If TypeOf shape Is ISmartArt Then 'Traverse through all nodes inside SmartArt @@ -358,30 +358,28 @@ You can remove a node from the [SmartArt](https://help.syncfusion.com/cr/documen {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/SmartArts/Remove-child-node-from-existing-SmartArt/.NET/Remove-child-node-from-existing-SmartArt/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); //Get the first slide from the Presentation. ISlide slide = pptxDoc.Slides[0]; //Get the SmartArt from slide. ISmartArt smartArt = slide.Shapes[0] as ISmartArt; //Remove a node at the specified index. smartArt.Nodes.RemoveAt(4); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Open a PowerPoint Presentation -IPresentation pptxDoc = Presentation.Open("SampleDocument.pptx"); +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); //Get the first slide from the Presentation. ISlide slide = pptxDoc.Slides[0]; //Get the SmartArt from slide. ISmartArt smartArt = slide.Shapes[0] as ISmartArt; -//Remove a node at the specified index. +//Remove a node at the specified (zero-based) index. smartArt.Nodes.RemoveAt(4); //Save the Presentation. pptxDoc.Save("SmartArt.pptx"); @@ -391,7 +389,7 @@ pptxDoc.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Open a PowerPoint Presentation -Dim pptxDoc As IPresentation = Presentation.Open("SampleDocument.pptx") +Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") 'Get the first slide from the Presentation. Dim slide As ISlide = pptxDoc.Slides(0) 'Get the SmartArt from slide. @@ -410,7 +408,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Assistant nodes in SmartArt -You can check whether a node is an assistant or not. Also you can change a node as assistant node or revert an assistant node to normal node.  The following code example demonstrates making an assistant node as normal node. +You can check whether a node is an assistant or not, change a node to an assistant node, or revert an assistant node to a normal node. The following code example demonstrates changing an assistant node to a normal node. {% tabs %} @@ -424,14 +422,15 @@ ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.OrganizationChart, 0, //Traverse through all nodes of the SmartArt. foreach (ISmartArtNode node in smartArt.Nodes) { - //Check if the node is assistant or not. + //Check if the node is an assistant or not. if (node.IsAssistant) - //Set the assistant node to false. + { + //Set the IsAssistant property to false. node.IsAssistant = false; + } } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("SmartArt.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the PowerPoint Presentation +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} @@ -439,7 +438,6 @@ pptxDoc.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} // Create an instance of PowerPoint Presentation IPresentation pptxDoc = Presentation.Create(); - //Add a blank slide to the Presentation ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a SmartArt to the slide at the specified size and position @@ -447,13 +445,15 @@ ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.OrganizationChart, 0, //Traverse through all nodes of the SmartArt. foreach (ISmartArtNode node in smartArt.Nodes) { - //Check if the node is assistant or not. + //Check if the node is an assistant or not. if (node.IsAssistant) - //Set the assistant node to false. - node.IsAssistant = false; + { + //Set the IsAssistant property to false. + node.IsAssistant = false; + } } //Save the Presentation. -pptxDoc.Save("Sample.pptx"); +pptxDoc.Save("SmartArt.pptx"); //Close the Presentation. pptxDoc.Close(); {% endhighlight %} @@ -467,26 +467,30 @@ Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.OrganizationChart, 0, 0, 640, 426.96) 'Traverse through all nodes of the SmartArt. For Each node As ISmartArtNode In smartArt.Nodes - 'Check if the node is assistant or not. + 'Check if the node is an assistant or not. If node.IsAssistant Then - 'Set the assistant node to false. + 'Set the IsAssistant property to False. node.IsAssistant = False End If Next 'Save the Presentation. -pptxDoc.Save("Sample.pptx") +pptxDoc.Save("SmartArt.pptx") 'Close the Presentation. pptxDoc.Close() {% endhighlight %} {% endtabs %} +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/SmartArts/Assistant-nodes-in-SmartArt). + ## Limitations -The modifications in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) (like add/remove nodes, modify position and size of nodes etc., which involve [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) layout changes) done by Essential® Presentation will not reflected in Image and PDF conversion. Whereas layout changes will be reflected properly in the generated PPTX file when opened using Microsoft PowerPoint. +> Modifications in a [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) (such as adding/removing nodes, modifying the position and size of nodes, and other changes that involve [SmartArt](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISmartArt.html) layout changes) made by Essential® Presentation will not be reflected in image and PDF conversion. The layout changes will be reflected properly in the generated PPTX file when opened using Microsoft PowerPoint. ## Supported SmartArt layout types +For the complete list of supported layout types, see the [SmartArtType](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.SmartArtType.html) API reference. The following are some commonly used types: + 1. Basic Block List 2. Alternating Hexagons 3. Picture Caption List diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Supported-and-Unsupported-Features.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Supported-and-Unsupported-Features.md index bfdf8c2204..50c59c7fe1 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Supported-and-Unsupported-Features.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Supported-and-Unsupported-Features.md @@ -1,6 +1,6 @@ --- title: Supported and Unsupported Features | Syncfusion -description: Know more about the File Format’s supported and unsupported features of Presentation Library and its various platforms. +description: Know more about the supported and unsupported features of the Syncfusion Presentation (PowerPoint) library and its various platforms. platform: document-processing control: Presentation documentation: UG @@ -688,3 +688,28 @@ Yes + +## Platform-Specific Setup + +Install and configure the Presentation library on the platform you target. Each guide covers prerequisites, NuGet packages, and a working code sample. + +- [Windows Forms](create-read-edit-powerpoint-files-in-windows-forms.md) +- [WPF](create-read-edit-powerpoint-files-in-wpf.md) +- [ASP.NET Web Forms](create-read-edit-powerpoint-files-in-asp-net-web-forms.md) +- [ASP.NET MVC](create-read-edit-powerpoint-files-in-asp-net-mvc.md) +- [ASP.NET Core](create-read-edit-powerpoint-files-in-asp-net-core-c-sharp.md) +- [.NET MAUI](create-read-edit-powerpoint-files-in-maui.md) +- [WinUI](create-read-edit-powerpoint-files-in-winui.md) +- [Xamarin](create-read-edit-powerpoint-files-in-xamarin.md) +- [UWP](create-read-edit-powerpoint-files-in-uwp.md) +- [Blazor](create-read-edit-powerpoint-files-in-blazor.md) + +## See Also + +- [Getting Started with the Presentation Library](Getting-Started.md) +- [NuGet Packages Required](NuGet-Packages-Required.md) +- [Assemblies Required](Assemblies-Required.md) +- [Document Object Model](Document-Object-Model.md) +- [Feature Matrix](Feature-Matrix.md) +- [Loading and Saving the Presentation](Loading-and-Saving-the-Presentation.md) +- [FAQ](FAQ.md) diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Hyperlinks.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Hyperlinks.md index e9be304ebd..57cb4c8f90 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Hyperlinks.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Hyperlinks.md @@ -7,74 +7,73 @@ documentation: UG --- # Working with Hyperlinks -The Hyperlink is a reference to data that can link to external contents like images, files, webpage, and more. In PowerPoint slide, a hyperlink may target to any one of the following sources: +A hyperlink is a reference that links to external content such as images, files, web pages, and more. In a PowerPoint slide, a hyperlink can target any of the following: -* Webpage: Represents the web content. -* File: Represents the file in some location. -* Email: Represents an Email. -* Slide: Represents the slide in the same document. +* Webpage: Represents web content. +* File: Represents a file in some location. +* Email: Represents an email address. +* Slide: Represents a slide in the same document. ## Add hyperlink to PowerPoint shape -You can navigate to any slide of the same PowerPoint document. The following code example demonstrates how to add the hyperlink for internal document navigation. +You can navigate to any slide of the same PowerPoint document by attaching a slide-target hyperlink to a shape. The following code example demonstrates how to add a hyperlink for internal document navigation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Add-hyperlink-to-PowerPoint-shape/.NET/Add-hyperlink-to-PowerPoint-shape/Program.cs" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide1 = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds one more slide. +//Add a second slide that the hyperlink will target. ISlide slide2 = pptxDoc.Slides.Add(); -//Adds normal shape to the first slide +//Add a rectangle shape to the first slide. IShape shape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100); -//Sets the target slide index (index is valid from 0 to slides count – 1) as hyperlink +//Set the target slide index (index is valid from 0 to slides count – 1) as the hyperlink target. IHyperLink hyperLink = shape.SetHyperlink("1"); -//Gets the target slide of the hyperlink +//Get the target slide resolved by the hyperlink. ISlide targetSlide = hyperLink.TargetSlide; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Sample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide1 = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds one more slide. +//Add a second slide that the hyperlink will target. ISlide slide2 = pptxDoc.Slides.Add(); -//Adds normal shape to the first slide +//Add a rectangle shape to the first slide. IShape shape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100); -//Sets the target slide index (index is valid from 0 to slides count – 1) as hyperlink +//Set the target slide index (index is valid from 0 to slides count – 1) as the hyperlink target. IHyperLink hyperLink = shape.SetHyperlink("1"); -//Gets the target slide of the hyperlink +//Get the target slide resolved by the hyperlink. ISlide targetSlide = hyperLink.TargetSlide; -//Save the presentation +//Save the presentation. pptxDoc.Save("Sample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates the PowerPoint Presentation instance -Dim pptxDoc As IPresentation = Presentation.Create() -'Adds a slide of blank layout type -Dim slide1 As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Adds one more slide. -Dim slide2 As ISlide = pptxDoc.Slides.Add() -'Adds normal shape to the first slide -Dim shape As IShape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100) -'Sets the target slide index (index is valid from 0 to slides count – 1) as hyperlink +'Create a new PowerPoint Presentation instance. +Dim pptxDoc As IPresentation = Presentation.Create() +'Add a slide with a blank layout to the presentation. +Dim slide1 As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) +'Add a second slide that the hyperlink will target. +Dim slide2 As ISlide = pptxDoc.Slides.Add() +'Add a rectangle shape to the first slide. +Dim shape As IShape = slide1.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100) +'Set the target slide index (index is valid from 0 to slides count – 1) as the hyperlink target. Dim hyperLink As IHyperLink = shape.SetHyperlink("1") -'Gets the target slide of the hyperlink +'Get the target slide resolved by the hyperlink. Dim targetSlide As ISlide = hyperLink.TargetSlide -'Save the presentation +'Save the presentation. pptxDoc.Save("Sample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -84,67 +83,65 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Add hyperlink to text -You can navigate to the specified URL from a PowerPoint slide. The following code example demonstrates how to add the web URL as a hyperlink. +You can link a shape's text to a specified URL within a PowerPoint slide. The following code example demonstrates how to add a web URL as a hyperlink. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Add-hyperlink-to-PowerPoint-text/.NET/Add-hyperlink-to-PowerPoint-text/Program.cs" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds normal shape to the first slide +//Add a rectangle shape to the slide. IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100); -//Adds paragraph into the shape +//Add a paragraph into the shape. IParagraph paragraph = shape.TextBody.AddParagraph(); -//Adds text to the TextPart +//Add text to the TextPart. paragraph.Text = "Syncfusion"; -//Sets the web hyperlink to the TextPart +//Set the web hyperlink to the TextPart. IHyperLink hyperLink = paragraph.TextParts[0].SetHyperlink("http://www.syncfusion.com"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Sample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds normal shape to the first slide +//Add a rectangle shape to the slide. IShape shape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100); -//Adds paragraph into the shape +//Add a paragraph into the shape. IParagraph paragraph = shape.TextBody.AddParagraph(); -//Adds text to the TextPart +//Add text to the TextPart. paragraph.Text = "Syncfusion"; -//Sets the web hyperlink to the TextPart +//Set the web hyperlink to the TextPart. IHyperLink hyperLink = paragraph.TextParts[0].SetHyperlink("http://www.syncfusion.com"); -//Save the presentation +//Save the presentation. pptxDoc.Save("Sample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates the PowerPoint Presentation instance -Dim pptxDoc As IPresentation = Presentation.Create() -'Adds a slide of blank layout type -Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Adds normal shape to the first slide -Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle,100,20,200,100) -'Adds paragraph into the shape -Dim paragraph As IParagraph = shape.TextBody.AddParagraph() -'Adds text to the TextPart +'Create a new PowerPoint Presentation instance. +Dim pptxDoc As IPresentation = Presentation.Create() +'Add a slide with a blank layout to the presentation. +Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) +'Add a rectangle shape to the slide. +Dim shape As IShape = slide.Shapes.AddShape(AutoShapeType.Rectangle, 100, 20, 200, 100) +'Add a paragraph into the shape. +Dim paragraph As IParagraph = shape.TextBody.AddParagraph() +'Add text to the TextPart. paragraph.Text = "Syncfusion" -'Sets the web hyperlink to the TextPart -Dim hyperLink As IHyperLink = paragraph.TextParts(0).SetHyperlink("http://www.syncfusion.com") -'Save the presentation +'Set the web hyperlink to the TextPart. +Dim hyperLink As IHyperLink = paragraph.TextParts(0).SetHyperlink("http://www.syncfusion.com") +'Save the presentation. pptxDoc.Save("Sample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() - {% endhighlight %} {% endtabs %} @@ -153,59 +150,58 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Add hyperlink to picture -You can add the email link to the shape or text on a PowerPoint slide. The following code example demonstrates how to add an email hyperlink to the picture. +The following code example demonstrates how to add an email hyperlink to a picture. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Add-hyperlink-to-PowerPoint-picture/.NET/Add-hyperlink-to-PowerPoint-picture/Program.cs" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Gets a picture as stream +//Open the picture file as a stream. FileStream pictureStream = new FileStream("Image.png", FileMode.Open); -//Adds the picture to a slide by specifying its size and position. +//Add the picture to the slide by specifying its size and position. IPicture picture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250); -//Sets the Email hyperlink to the picture +//Set the email hyperlink to the picture. IHyperLink hyperLink = (picture as IShape).SetHyperlink("mailto:sales@syncfusion.com"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Sample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Gets a picture as stream +//Open the picture file as a stream. Stream pictureStream = File.Open("Image.png", FileMode.Open); -//Adds the picture to a slide by specifying its size and position. +//Add the picture to the slide by specifying its size and position. IPicture picture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250); -//Sets the Email hyperlink to the picture +//Set the email hyperlink to the picture. IHyperLink hyperLink = (picture as IShape).SetHyperlink("mailto:sales@syncfusion.com"); -//Save the presentation +//Save the presentation. pptxDoc.Save("Sample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates the PowerPoint Presentation instance -Dim pptxDoc As IPresentation = Presentation.Create() -'Adds a slide of blank layout type -Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Gets a picture as stream -Dim pictureStream As Stream = File.Open("Image.png",FileMode.Open) -'Adds the picture to a slide by specifying its size and position -Dim picture As IPicture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250) -'Sets the Email hyperlink to the picture -Dim hyperLink As IHyperLink = TryCast(picture, IShape).SetHyperlink("mailto:sales@syncfusion.com") -'Save the presentation +'Create a new PowerPoint Presentation instance. +Dim pptxDoc As IPresentation = Presentation.Create() +'Add a slide with a blank layout to the presentation. +Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) +'Open the picture file as a stream. +Dim pictureStream As Stream = File.Open("Image.png", FileMode.Open) +'Add the picture to the slide by specifying its size and position. +Dim picture As IPicture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250) +'Set the email hyperlink to the picture. +Dim hyperLink As IHyperLink = TryCast(picture, IShape).SetHyperlink("mailto:sales@syncfusion.com") +'Save the presentation. pptxDoc.Save("Sample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -213,61 +209,61 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Hyperlinks/Add-hyperlink-to-PowerPoint-picture). +### Add file hyperlink to picture + You can open external documents like images, text files, PDF, etc. from the PowerPoint slide. The following code example demonstrates how to add a file hyperlink to the picture. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Add-file-hyperlink-to-picture/.NET/Add-file-hyperlink-to-picture/Program.cs" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Gets a picture as stream +//Open the picture file as a stream. FileStream pictureStream = new FileStream("Image.png", FileMode.Open); -//Adds the picture to a slide by specifying its size and position +//Add the picture to the slide by specifying its size and position. IPicture picture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250); -//Sets the File path as hyperlink +//Set the file path as the hyperlink target. IHyperLink hyperLink = (picture as IShape).SetHyperlink("WordDocument.docx"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Sample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates the PowerPoint Presentation instance +//Create a new PowerPoint Presentation instance. IPresentation pptxDoc = Presentation.Create(); -//Adds a slide of blank layout type +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Gets a picture as stream +//Open the picture file as a stream. Stream pictureStream = File.Open("Image.png", FileMode.Open); -//Adds the picture to a slide by specifying its size and position +//Add the picture to the slide by specifying its size and position. IPicture picture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250); -//Sets the File path as hyperlink +//Set the file path as the hyperlink target. IHyperLink hyperLink = (picture as IShape).SetHyperlink("WordDocument.docx"); -//Save the presentation +//Save the presentation. pptxDoc.Save("Sample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates the PowerPoint Presentation instance -Dim pptxDoc As IPresentation = Presentation.Create() -'Adds a slide of blank layout type -Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Gets a picture as stream -Dim pictureStream As Stream = File.Open("Image.png",FileMode.Open) -'Adds the picture to a slide by specifying its size and position -Dim picture As IPicture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250) -'Sets the Email hyperlink to the picture +'Create a new PowerPoint Presentation instance. +Dim pptxDoc As IPresentation = Presentation.Create() +'Add a slide with a blank layout to the presentation. +Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) +'Open the picture file as a stream. +Dim pictureStream As Stream = File.Open("Image.png", FileMode.Open) +'Add the picture to the slide by specifying its size and position. +Dim picture As IPicture = slide.Pictures.AddPicture(pictureStream, 0, 0, 250, 250) +'Set the file path as the hyperlink target. Dim hyperLink As IHyperLink = TryCast(picture, IShape).SetHyperlink("WordDocument.docx") -'Save the presentation +'Save the presentation. pptxDoc.Save("Sample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() - {% endhighlight %} {% endtabs %} @@ -276,80 +272,82 @@ You can download a complete working sample from [GitHub](https://github.com/Sync N> The above link makes use of the absolute path of the file for navigation. So, moving the files to another machine or location may lead to file not found error in PowerPoint reader applications. -## Gets a hyperlink details from text and shape +## Get hyperlink details from text and shape -You can get the hyperlink details from the shape or text in a PowerPoint slide. +You can read the hyperlink details from a shape or from the text of a shape in a PowerPoint slide. -The following code example demonstrates how to get the details about the hyperlink from shape. +### Get hyperlink from a shape + +The following code example demonstrates how to get the details about the hyperlink from a shape. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Get-hyperlink-from-shape/.NET/Get-hyperlink-from-shape/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Retrieves the first slide from the Presentation +//Open an existing PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Gets the hyperlink from the shape +//Get the hyperlink from the shape. IHyperLink hyperlink = shape.Hyperlink; -//Gets the type of action, the hyperlink will be performed when the shape is clicked +//Get the type of action performed when the hyperlink is clicked. HyperLinkType hyperlinkType = hyperlink.Action; -//Gets the target slide of the hyperlink +//Get the target slide of the hyperlink. ISlide targetSlide = hyperlink.TargetSlide; -//Gets the url address of the hyperlink +//Get the URL address of the hyperlink. string url = hyperlink.Url; -//Gets the screen tip text of a hyperlink +//Get the screen tip text of the hyperlink. string screenTip = hyperlink.ScreenTip; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Result.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Result.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open an existing PowerPoint presentation +//Open an existing PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Retrieves the first slide from the Presentation +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Gets the hyperlink from the shape +//Get the hyperlink from the shape. IHyperLink hyperlink = shape.Hyperlink; -//Gets the type of action, the hyperlink will be performed when the shape is clicked +//Get the type of action performed when the hyperlink is clicked. HyperLinkType hyperlinkType = hyperlink.Action; -//Gets the target slide of the hyperlink +//Get the target slide of the hyperlink. ISlide targetSlide = hyperlink.TargetSlide; -//Gets the url address of the hyperlink +//Get the URL address of the hyperlink. string url = hyperlink.Url; -//Gets the screen tip text of a hyperlink +//Get the screen tip text of the hyperlink. string screenTip = hyperlink.ScreenTip; -//Save the presentation +//Save the presentation. pptxDoc.Save("Result.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open an existing PowerPoint presentation -Dim pptxDoc As IPresentation = Presentation.Open("Table.pptx") -'Retrieves the first shape from the slide -Dim shape As IShape = TryCast(slide.Shapes(0), IShape) -'Gets the hyperlink from the shape -Dim hyperlink As IHyperLink = shape.Hyperlink -'Gets the type of action, the hyperlink will be performed when the shape is clicked -Dim hyperlinkType As HyperLinkType = hyperlink.Action -'Gets the target slide of the hyperlink -Dim targetSlide As ISlide = hyperlink.TargetSlide -'Gets the url address of the hyperlink -Dim url As String = hyperlink.Url -'Gets the screen tip text of a hyperlink -Dim screenTip As String = hyperlink.ScreenTip -'Save the presentation -pptxDoc.Save("Sample.pptx") -'Close the presentation +'Open an existing PowerPoint presentation. +Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") +'Retrieve the first slide from the presentation. +Dim slide As ISlide = pptxDoc.Slides(0) +'Retrieve the first shape from the slide. +Dim shape As IShape = TryCast(slide.Shapes(0), IShape) +'Get the hyperlink from the shape. +Dim hyperlink As IHyperLink = shape.Hyperlink +'Get the type of action performed when the hyperlink is clicked. +Dim hyperlinkType As HyperLinkType = hyperlink.Action +'Get the target slide of the hyperlink. +Dim targetSlide As ISlide = hyperlink.TargetSlide +'Get the URL address of the hyperlink. +Dim url As String = hyperlink.Url +'Get the screen tip text of the hyperlink. +Dim screenTip As String = hyperlink.ScreenTip +'Save the presentation. +pptxDoc.Save("Result.pptx") +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -357,88 +355,90 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Hyperlinks/Get-hyperlink-from-shape). +### Get hyperlink from text + The following code example demonstrates how to get the details about the hyperlink from text. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Get-hyperlink-from-text/.NET/Get-hyperlink-from-text/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Retrieves the first slide from the Presentation. +//Open an existing PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Retrieves the first paragraph of the shape +//Retrieve the first paragraph of the shape. IParagraph paragraph = shape.TextBody.Paragraphs[0]; -//Retrieves the first TextPart of the shape +//Retrieve the first TextPart of the shape. ITextPart textPart = paragraph.TextParts[0]; -//Gets the hyperlink from the text +//Get the hyperlink from the text. IHyperLink hyperlink = textPart.Hyperlink; -//Gets the type of action, the hyperlink will be performed when the shape is clicked +//Get the type of action performed when the hyperlink is clicked. HyperLinkType hyperlinkType = hyperlink.Action; -//Gets the target slide of the hyperlink +//Get the target slide of the hyperlink. ISlide targetSlide = hyperlink.TargetSlide; -//Gets the url address of the hyperlink +//Get the URL address of the hyperlink. string url = hyperlink.Url; -//Gets the screen tip text of a hyperlink +//Get the screen tip text of the hyperlink. string screenTip = hyperlink.ScreenTip; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Result.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Result.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open an existing PowerPoint presentation +//Open an existing PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Retrieves the first slide from the Presentation +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Retrieves the first paragraph of the shape +//Retrieve the first paragraph of the shape. IParagraph paragraph = shape.TextBody.Paragraphs[0]; -//Retrieves the first TextPart of the shape +//Retrieve the first TextPart of the shape. ITextPart textPart = paragraph.TextParts[0]; -//Gets the hyperlink from the text +//Get the hyperlink from the text. IHyperLink hyperlink = textPart.Hyperlink; -//Gets the type of action, the hyperlink will be performed when the shape is clicked +//Get the type of action performed when the hyperlink is clicked. HyperLinkType hyperlinkType = hyperlink.Action; -//Gets the target slide of the hyperlink +//Get the target slide of the hyperlink. ISlide targetSlide = hyperlink.TargetSlide; -//Gets the url address of the hyperlink +//Get the URL address of the hyperlink. string url = hyperlink.Url; -//Gets the screen tip text of a hyperlink +//Get the screen tip text of the hyperlink. string screenTip = hyperlink.ScreenTip; -//Save the presentation +//Save the presentation. pptxDoc.Save("Result.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open an existing PowerPoint presentation +'Open an existing PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") -'Retrieves the first shape from the slide +'Retrieve the first slide from the presentation. +Dim slide As ISlide = pptxDoc.Slides(0) +'Retrieve the first shape from the slide. Dim shape As IShape = TryCast(slide.Shapes(0), IShape) -'Retrieves the first paragraph of the shape +'Retrieve the first paragraph of the shape. Dim paragraph As IParagraph = shape.TextBody.Paragraphs(0) -'Retrieves the first TextPart of the shape +'Retrieve the first TextPart of the shape. Dim textPart As ITextPart = paragraph.TextParts(0) -'Gets the hyperlink from the text -Dim hyperlink As IHyperLink = textPart.Hyperlink -'Gets the type of action, the hyperlink will be performed when the shape is clicked -Dim hyperlinkType As HyperLinkType = hyperlink.Action -'Gets the target slide of the hyperlink -Dim targetSlide As ISlide = hyperlink.TargetSlide -'Gets the url address of the hyperlink -Dim url As String = hyperlink.Url -'Gets the screen tip text of a hyperlink -Dim screenTip As String = hyperlink.ScreenTip -'Save the presentation +'Get the hyperlink from the text. +Dim hyperlink As IHyperLink = textPart.Hyperlink +'Get the type of action performed when the hyperlink is clicked. +Dim hyperlinkType As HyperLinkType = hyperlink.Action +'Get the target slide of the hyperlink. +Dim targetSlide As ISlide = hyperlink.TargetSlide +'Get the URL address of the hyperlink. +Dim url As String = hyperlink.Url +'Get the screen tip text of the hyperlink. +Dim screenTip As String = hyperlink.ScreenTip +'Save the presentation. pptxDoc.Save("Result.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -450,52 +450,54 @@ You can download a complete working sample from [GitHub](https://github.com/Sync You can remove the hyperlink from the shape or text in a PowerPoint slide. -The following code example demonstrates how to remove a hyperlink from the shape in a PowerPoint slide. +### Remove hyperlink from a shape + +The following code example demonstrates how to remove a hyperlink from a shape in a PowerPoint slide. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Remove-hyperlink-from-shape/.NET/Remove-hyperlink-from-shape/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Retrieves the first slide from the Presentation +//Open an existing PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Removes the hyperlink from the shape +//Remove the hyperlink from the shape. shape.RemoveHyperlink(); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Result.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Result.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open an existing PowerPoint presentation +//Open an existing PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Retrieves the first slide from the Presentation +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Removes the hyperlink from the shape +//Remove the hyperlink from the shape. shape.RemoveHyperlink(); -//Save the presentation +//Save the presentation. pptxDoc.Save("Result.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open an existing PowerPoint presentation +'Open an existing PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") -'Retrieves the first shape from the slide +'Retrieve the first slide from the presentation. +Dim slide As ISlide = pptxDoc.Slides(0) +'Retrieve the first shape from the slide. Dim shape As IShape = TryCast(slide.Shapes(0), IShape) -'Removes the hyperlink from the shape +'Remove the hyperlink from the shape. shape.RemoveHyperlink() -'Save the presentation +'Save the presentation. pptxDoc.Save("Result.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -503,67 +505,78 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Hyperlinks/Remove-hyperlink-from-shape). +### Remove hyperlink from text + The following code example demonstrates how to remove a hyperlink from the text in a PowerPoint slide. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Hyperlinks/Remove-hyperlink-from-text/.NET/Remove-hyperlink-from-text/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Retrieves the first slide from the Presentation +//Open an existing PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Retrieves the first paragraph of the shape +//Retrieve the first paragraph of the shape. IParagraph paragraph = shape.TextBody.Paragraphs[0]; -//Retrieves the first TextPart of the shape +//Retrieve the first TextPart of the shape. ITextPart textPart = paragraph.TextParts[0]; -//Removes the hyperlink from the TextPart +//Remove the hyperlink from the TextPart. textPart.RemoveHyperLink(); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Result.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint Presentation to a file. +pptxDoc.Save("Result.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open an existing PowerPoint presentation +//Open an existing PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Retrieves the first slide from the Presentation +//Retrieve the first slide from the presentation. ISlide slide = pptxDoc.Slides[0]; -//Retrieves the first shape from the slide +//Retrieve the first shape from the slide. IShape shape = slide.Shapes[0] as IShape; -//Retrieves the first paragraph of the shape +//Retrieve the first paragraph of the shape. IParagraph paragraph = shape.TextBody.Paragraphs[0]; -//Retrieves the first TextPart of the shape +//Retrieve the first TextPart of the shape. ITextPart textPart = paragraph.TextParts[0]; -//Removes the hyperlink from the TextPart +//Remove the hyperlink from the TextPart. textPart.RemoveHyperLink(); -//Save the presentation +//Save the presentation. pptxDoc.Save("Result.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open an existing PowerPoint presentation +'Open an existing PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") -'Retrieves the first shape from the slide +'Retrieve the first slide from the presentation. +Dim slide As ISlide = pptxDoc.Slides(0) +'Retrieve the first shape from the slide. Dim shape As IShape = TryCast(slide.Shapes(0), IShape) -'Retrieves the first paragraph of the shape +'Retrieve the first paragraph of the shape. Dim paragraph As IParagraph = shape.TextBody.Paragraphs(0) -'Retrieves the first TextPart of the shape +'Retrieve the first TextPart of the shape. Dim textPart As ITextPart = paragraph.TextParts(0) -'Removes the hyperlink from the TextPart +'Remove the hyperlink from the TextPart. textPart.RemoveHyperLink() -'Save the presentation +'Save the presentation. pptxDoc.Save("Result.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Hyperlinks/Remove-hyperlink-from-text). \ No newline at end of file +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Hyperlinks/Remove-hyperlink-from-text). + +## See also + +* [Working with Shapes](./Working-with-Shapes) +* [Working with Pictures](./Working-with-Pictures) +* [Working with Text](./Working-with-Text) +* [Loading and Saving the Presentation](Loading-and-Saving-the-Presentation) +* [Assemblies-Required](Assemblies-Required) +* [NuGet-Packages-Required](NuGet-Packages-Required) \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Macros.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Macros.md index 91f9f85bec..8f04f89e9c 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Macros.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-Macros.md @@ -1,60 +1,59 @@ --- -title: Create and edit macros in PowerPoint files | Syncfusion | -description: Learn here all about working with macros in .NET PowerPoint Presentation Library and more. +title: Working with macros in PowerPoint files | Syncfusion +description: Learn here all about loading, saving, and removing macros in a .NET PowerPoint presentation using the Syncfusion Presentation library. platform: document-processing control: Presentation documentation: UG +keywords: macros in powerpoint, pptm, potm, vba, hasmacros, removemacros --- -# Working with Macros in PowerPoint Presentation Library +# Working with Macros in PowerPoint Presentation -A macro is a series of commands that can be grouped together as a single command to automate a frequently used tasks. Macros can be created for Microsoft PowerPoint using Visual Basic for Applications (VBA). Please refer [Create Macros in PowerPoint](https://support.office.com/en-us/article/Create-a-macro-in-PowerPoint-5b07aff6-4dc9-462f-8fc9-66b4c5344e7e?ui=en-US&rs=en-US&ad=US) for more details +A macro is a series of commands that can be grouped together as a single command to automate frequently used tasks. Macros can be created for Microsoft PowerPoint using Visual Basic for Applications (VBA). Refer to the [Create a macro in PowerPoint](https://support.office.com/en-us/article/Create-a-macro-in-PowerPoint-5b07aff6-4dc9-462f-8fc9-66b4c5344e7e) documentation for more details. -Macros enabled PowerPoint presentations of file types - .PPTM and .POTM can only be preserved using Essential® Presentation. +Macro-enabled PowerPoint presentations of file types `.PPTM` and `.POTM` can be loaded, modified, and saved while preserving the embedded VBA project using the Syncfusion Presentation library. -## Loading and Saving Macro enabled Presentation +## Loading and saving a macro-enabled presentation -The following code illustrates how to load and save a macro enabled presentation. +The following code example illustrates how to load a macro-enabled PowerPoint presentation and save it back to disk while preserving the macros. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Macros/Load-and-save-macro-PowerPoint/.NET/Load-and-save-macro-PowerPoint/Program.cs" %} -//Opens an existing macro enabled PowerPoint presentation -FileStream inputStream = new FileStream("Sample.PPTM",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Adds a blank slide to the presentation +//Open an existing macro-enabled PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("Sample.PPTM"); +//Add a blank slide to the presentation ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds a text box to the slide +//Add a text box to the slide IParagraph paragraph = slide.Shapes.AddTextBox(100, 100, 300, 80).TextBody.AddParagraph("Preserve Macros"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Output.PPTM", FileMode.Create); -pptxDoc.Save(outputStream); -//Closes the presentation +//Save the PowerPoint presentation +pptxDoc.Save("Output.PPTM"); +//Close the presentation pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens an existing macro enabled PowerPoint presentation +//Open an existing macro-enabled PowerPoint presentation IPresentation pptxDoc = Presentation.Open("Sample.PPTM"); -//Adds a blank slide to the presentation +//Add a blank slide to the presentation ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Adds a text box to the slide +//Add a text box to the slide IParagraph paragraph = slide.Shapes.AddTextBox(100, 100, 300, 80).TextBody.AddParagraph("Preserve Macros"); -//Saves the presentation +//Save the presentation pptxDoc.Save("Output.PPTM"); -//Closes the presentation +//Close the presentation pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens an existing macro enabled PowerPoint presentation +'Open an existing macro-enabled PowerPoint presentation Dim pptxDoc As IPresentation = Presentation.Open("Sample.PPTM") -'Adds a blank slide to the presentation +'Add a blank slide to the presentation Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Adds a text box to the slide +'Add a text box to the slide Dim paragraph As IParagraph = slide.Shapes.AddTextBox(100, 100, 300, 80).TextBody.AddParagraph("Preserve Macros") -'Saves the presentation +'Save the presentation pptxDoc.Save("Output.PPTM") -'Closes the presentation +'Close the presentation pptxDoc.Close() {% endhighlight %} @@ -62,51 +61,55 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Macros/Load-and-save-macro-PowerPoint). -## Removing Macros from Macro enabled Presentation +## Removing macros from a macro-enabled presentation The following code example illustrates how to remove the macros present in the presentation, {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Macros/Remove-macros/.NET/Remove-macros/Program.cs" %} -//Opens an existing macro enabled PowerPoint presentation -FileStream inputStream = new FileStream("Sample.PPTM",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Checks whether the presentation has macros and then removes them +//Open an existing macro-enabled PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("Sample.PPTM"); +//Check whether the presentation has macros and then remove them if (pptxDoc.HasMacros) pptxDoc.RemoveMacros(); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Output.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Closes the presentation +//Save the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Close the presentation pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens an existing macro enabled PowerPoint presentation +//Open an existing macro-enabled PowerPoint presentation IPresentation pptxDoc = Presentation.Open("Sample.PPTM"); -//Checks whether the presentation has macros and then removes them +//Check whether the presentation has macros and then remove them if (pptxDoc.HasMacros) pptxDoc.RemoveMacros(); -//Saves the presentation +//Save the presentation pptxDoc.Save("Output.pptx"); -//Closes the presentation +//Close the presentation pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens an existing macro enabled PowerPoint presentation +'Open an existing macro-enabled PowerPoint presentation Dim pptxDoc As IPresentation = Presentation.Open("Sample.PPTM") -'Checks whether the presentation has macros and then removes them +'Check whether the presentation has macros and then remove them If pptxDoc.HasMacros Then pptxDoc.RemoveMacros() End If -'Saves the presentation +'Save the presentation pptxDoc.Save("Output.pptx") -'Closes the presentation +'Close the presentation pptxDoc.Close() {% endhighlight %} {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Macros/Remove-macros). \ No newline at end of file +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Macros/Remove-macros). + +## See also + +* [Loading and saving the presentation](./Loading-and-Saving-the-Presentatio) +* [NuGet packages required](./NuGet-Packages-Required) +* [Assemblies required](./Assemblies-Required) \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-NotesSlide.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-NotesSlide.md index 7d6a495d82..a09fde3466 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-NotesSlide.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-NotesSlide.md @@ -9,11 +9,15 @@ keywords: Working with Notes # Working with PowerPoint Notes -Notes are the contents associated with each slide and are visible only to the presenter when monitors are shared in “Presenter View”. It shows hint for the speaker, so it is often called as “Speaker Notes”. The presenter can optionally add key points to notes. You can add and modify the notes in your slide using Essential® Presentation library. +Notes are the contents associated with each slide and are visible only to the presenter when monitors are shared in “Presenter View”. They show hints for the speaker, so they are often called “Speaker Notes”. The presenter can optionally add key points to notes. You can add and modify the notes in your slide using Syncfusion® Presentation library. + +## Prerequisites + +Before you begin, make sure the following NuGet package is installed in your application. For more information on the assemblies and NuGet packages required for your target platform, refer to [Assemblies Required](Assemblies-Required) and [NuGet Packages Required](NuGet-Packages-Required). ## Adding Notes to a Slide -The below code example demonstrates how to create a Notes in a PowerPoint Slide. +The following code example demonstrates how to add notes to a PowerPoint slide. {% tabs %} @@ -27,9 +31,10 @@ ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); INotesSlide notesSlide = slide.AddNotesSlide(); //Adds text content into the Notes Slide. notesSlide.NotesTextBody.AddParagraph("Notes content"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream(OutputFileName, FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system. +pptxDoc.Save("PresentationWithNotesSlide.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -43,6 +48,8 @@ INotesSlide notesSlide = slide.AddNotesSlide(); notesSlide.NotesTextBody.AddParagraph("Notes content"); //Saves Presentation with specified file name with extension. pptxDoc.Save("PresentationWithNotesSlide.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -56,15 +63,19 @@ Dim notesSlide As INotesSlide = slide.AddNotesSlide() notesSlide.NotesTextBody.AddParagraph("Notes content") 'Saves Presentation with specified file name with extension. pptxDoc.Save("PresentationWithNotesSlide.pptx") +'Closes the Presentation. +pptxDoc.Close() {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Notes/Add-notes-to-PowerPoint-slide). -## Adding Text into the Notes +N> `AddNotesSlide()` returns the newly created `INotesSlide` for the specified slide. If a notes slide already exists for that slide, the existing notes slide is returned. The notes slide can also be accessed through the `slide.NotesSlide` property. -The following code example demonstrates how to add a text in a Notes. +## Adding Text into the Notes + +The following code example demonstrates how to add formatted text to notes. {% tabs %} @@ -76,20 +87,21 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Adds new notes slide in the specified slide. INotesSlide notesSlide = slide.AddNotesSlide(); -//Adds Paragraph into the text body. +//Adds a paragraph into the text body. IParagraph paragraph = notesSlide.NotesTextBody.AddParagraph(); -//Adds text part into the Paragraph. +//Adds a text part into the paragraph. ITextPart textPart = paragraph.AddTextPart(); textPart.Text = "The notes slide represents the contents and key notes of the corresponding slide. It is more useful when we use Presenter View while presenting the seminars through SlideShow."; //Sets Bold format for text content. -textPart.Font.Bold=true; -// Sets font style using font name. +textPart.Font.Bold = true; +//Sets font style using font name. textPart.Font.FontName = "Times New Roman"; -// Sets text content size using FontSize property. +//Sets text content size using FontSize property. textPart.Font.FontSize = 20; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream(OutputFileName, FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system. +pptxDoc.Save("PresentationWithNotesText.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -99,19 +111,21 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Adds new notes slide in the specified slide. INotesSlide notesSlide = slide.AddNotesSlide(); -//Adds Paragraph into the text body. +//Adds a paragraph into the text body. IParagraph paragraph = notesSlide.NotesTextBody.AddParagraph(); -//Adds text part into the Paragraph. +//Adds a text part into the paragraph. ITextPart textPart = paragraph.AddTextPart(); textPart.Text = "The notes slide represents the contents and key notes of the corresponding slide. It is more useful when we use Presenter View while presenting the seminars through SlideShow."; //Sets Bold format for text content. -textPart.Font.Bold=true; -// Sets font style using font name. +textPart.Font.Bold = true; +//Sets font style using font name. textPart.Font.FontName = "Times New Roman"; -// Sets text content size using FontSize property. +//Sets text content size using FontSize property. textPart.Font.FontSize = 20; //Saves Presentation with specified file name with extension. -pptxDoc.Save("PresentationWithNotesSlide.pptx"); +pptxDoc.Save("PresentationWithNotesText.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -121,9 +135,9 @@ Dim pptxDoc As IPresentation = Presentation.Create() Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) 'Adds new notes slide in the specified slide. Dim notesSlide As INotesSlide = slide.AddNotesSlide() -'Adds Paragraph into the text body. +'Adds a paragraph into the text body. Dim paragraph As IParagraph = notesSlide.NotesTextBody.AddParagraph() -'Adds text part into the Paragraph. +'Adds a text part into the paragraph. Dim textPart As ITextPart = paragraph.AddTextPart() textPart.Text = "The notes slide represents the contents and key notes of the corresponding slide. It is more useful when we use Presenter View while presenting the seminars through SlideShow." 'Sets Bold format for text content. @@ -133,16 +147,20 @@ textPart.Font.FontName = "Times New Roman" 'Sets text content size using FontSize property. textPart.Font.FontSize = 20 'Saves Presentation with specified file name with extension. -pptxDoc.Save("PresentationWithNotesSlide.pptx") +pptxDoc.Save("PresentationWithNotesText.pptx") +'Closes the Presentation. +pptxDoc.Close() {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Notes/Add-text-in-notes). -## Adding a numbered list to Notes +N> In addition to `Bold`, `FontName`, and `FontSize`, the `ITextPart.Font` property exposes formatting options such as `Italic`, `Underline`, `FontColor`, `HighlightColor`, `StrikeThrough`, `BaselineAlignment`, and `FontScript`. For the full list of members, refer to the [ITextPart API reference](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ITextPart.html). -The following code example demonstrates how to create simple numbered list as Notes. +## Adding a Numbered List to Notes + +The following code example demonstrates how to create a simple numbered list as notes. {% tabs %} @@ -193,8 +211,7 @@ paragraph.FirstLineIndent = -20; // Sets the bullet character size. Here, 100 means 100% of its text. Possible values can range from 25 to 400. paragraph.ListFormat.Size = 100; //Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream(OutputFileName, FileMode.Create); -pptxDoc.Save(outputStream); +pptxDoc.Save(OutputFileName); //Closes the Presentation pptxDoc.Close(); {% endhighlight %} @@ -305,48 +322,58 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Notes/Create-numbered-list-in-notes-slide). + ## Removing Notes from a Slide -The below code example demonstrates how to remove a Notes from a PowerPoint Slide. +The following code example demonstrates how to remove the notes slide from a PowerPoint slide. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Notes/Remove-notes-from-slide/.NET/Remove-notes-from-slide/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets instance of the first slide from the Presentation. +//Opens an existing PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); +//Gets the instance of the first slide from the presentation. ISlide slide = pptxDoc.Slides[0] as ISlide; -//Removes Notes Slide from a corresponding slide. +//Removes the notes slide from the corresponding slide. slide.RemoveNotesSlide(); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream(OutputFileName, FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system. +pptxDoc.Save("PresentationWithNotesSlide.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Opens an existing PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("Sample.pptx"); -//Gets instance of the first slide from the Presentation. +//Gets the instance of the first slide from the presentation. ISlide slide = pptxDoc.Slides[0] as ISlide; -//Removes Notes Slide from a corresponding slide. +//Removes the notes slide from the corresponding slide. slide.RemoveNotesSlide(); -//Saves Presentation with specified file name with extension. +//Saves the Presentation with the specified file name and extension. pptxDoc.Save("PresentationWithNotesSlide.pptx"); +//Closes the Presentation. +pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Opens an existing PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("Sample.pptx") -'Gets instance of the first slide from the Presentation. +'Gets the instance of the first slide from the presentation. Dim slide As ISlide = TryCast(pptxDoc.Slides(0), ISlide) -'Removes Notes Slide from a corresponding slide. +'Removes the notes slide from the corresponding slide. slide.RemoveNotesSlide() -'Saves Presentation with specified file name with extension. +'Saves the Presentation with the specified file name and extension. pptxDoc.Save("PresentationWithNotesSlide.pptx") +'Closes the Presentation. +pptxDoc.Close() {% endhighlight %} {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Notes/Remove-notes-from-slide). \ No newline at end of file +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Notes/Remove-notes-from-slide). + +## See Also + +- [Working with Comments](Comments) +- [Working with Paragraphs](./Working-with-paragraphs) \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-OLE-Objects.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-OLE-Objects.md index 881d6b4f20..06304678fa 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-OLE-Objects.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-OLE-Objects.md @@ -8,78 +8,94 @@ keywords: OLE Object in PowerPoint presentation --- # Working with OLE Objects -The OLE Object enables sharing of application objects written in different file formats. In PowerPoint presentation the application data can be inserted into a PowerPoint slide using the [programmatic identifier](https://msdn.microsoft.com/en-us/library/aa171170(v=office.11).aspx#) of each file format. +The OLE Object enables sharing of application objects written in different file formats. In a PowerPoint presentation, the application data can be inserted into a PowerPoint slide using the [programmatic identifier](https://msdn.microsoft.com/en-us/library/aa171170(v=office.11).aspx#) of each file format. -## Inserting OLE Object to a Slide +## Prerequisites -The following code example demonstrates how to add an Excel worksheet into a slide. +Before using OLE objects in your project, ensure the following: + +- Install the required Syncfusion assemblies. Refer to the [Assemblies-Required](Assemblies-Required.md) and [NuGet-Packages-Required](NuGet-Packages-Required.md) pages for details. +- Keep the input files (such as `OleTemplate.xlsx`, `OleTemplate.docx`, and `OlePicture.png`) in the application's working directory. You can download them from the [GitHub sample](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/OLE-objects). +- For the extraction and link-path examples, the input presentation must already contain an embedded or linked OLE object. + +## Supported File Types and ProgIDs + +| Source file | ProgID | +|-------------|--------| +| Excel workbook (.xlsx) | `Excel.Sheet.12` | +| Word document (.docx) | `Word.Document.12` | +| PowerPoint presentation (.pptx) | `PowerPoint.Show.12` | +| PDF document (.pdf) | `AcroExch.Document.DC` | + +## Inserting an OLE Object into a Slide + +The following code example demonstrates how to add an Excel worksheet into a slide. Use the **C# [Cross-platform]** tab when targeting .NET on Windows, Linux, or macOS; use the **Windows-specific** tabs when using .NET Framework on Windows. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/OLE-objects/Add-Excel-in-PowerPoint-slide/.NET/Add-Excel-in-PowerPoint-slide/Program.cs" %} -//Create new instance of PowerPoint presentation. +//Create a new instance of the PowerPoint presentation. IPresentation pptxDoc = Presentation.Create(); -//Add slide with blank layout to presentation +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Get the excel file as stream -FileStream excelStream = new FileStream("OleTemplate.xlsx", FileMode.Open); -//Image to be displayed, This can be any image -FileStream imageStream = new FileStream("OlePicture.png", FileMode.Open); -//Add an OLE object to the slide -IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Excel.Sheet.12", excelStream); -//Set size and position of the OLE object +//Add an OLE object to the slide. +//Parameters: +// imagePath - The path to the image that represents the icon/preview of the OLE object. +// progId - The programmatic identifier of the source file (for example, "Excel.Sheet.12"). +// filePath - The path to the source file that is embedded into the presentation. +IOleObject oleObject = slide.Shapes.AddOleObject("OlePicture.png", "Excel.Sheet.12", "OleTemplate.xlsx"); +//Set the size and position of the OLE object. oleObject.Left = 10; oleObject.Top = 10; oleObject.Width = 400; oleObject.Height = 300; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("OleObjectSample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint presentation to a file. +pptxDoc.Save("OleObjectSample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Create new instance of PowerPoint presentation. [Equivalent to launching MS PowerPoint with no slides]. +//Create a new instance of the PowerPoint presentation. IPresentation pptxDoc = Presentation.Create(); -//Add slide with blank layout to presentation +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Get the excel file as stream +//Open the Excel file as a stream. Stream excelStream = File.Open("OleTemplate.xlsx", FileMode.Open); -//Image to be displayed, This can be any image +//Image to be displayed. This can be any image. Stream imageStream = File.Open("OlePicture.png", FileMode.Open); -//Add an OLE object to the slide +//Add an OLE object to the slide. IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Excel.Sheet.12", excelStream); -//Set size and position of the OLE object +//Set the size and position of the OLE object. oleObject.Left = 10; oleObject.Top = 10; oleObject.Width = 400; oleObject.Height = 300; -//Save the presentation +//Save the presentation. pptxDoc.Save("OleObjectSample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Create new instance of PowerPoint presentation. [Equivalent to launching MS PowerPoint with no slides]. +'Create a new instance of the PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Create() -'Add slide with blank layout to presentation +'Add a slide with a blank layout to the presentation. Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Get the excel file as stream +'Open the Excel file as a stream. Dim excelStream As Stream = File.Open("OleTemplate.xlsx", FileMode.Open) -'Image to be displayed, This can be any image +'Image to be displayed. This can be any image. Dim imageStream As Stream = File.Open("OlePicture.png", FileMode.Open) -'Add an OLE object to the slide +'Add an OLE object to the slide. Dim oleObject As IOleObject = slide.Shapes.AddOleObject(imageStream, "Excel.Sheet.12", excelStream) -'Set size and position of the OLE object +'Set the size and position of the OLE object. oleObject.Left = 10 oleObject.Top = 10 oleObject.Width = 400 oleObject.Height = 300 -'Save the presentation +'Save the presentation. pptxDoc.Save("OleObjectSample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -87,16 +103,23 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/OLE-objects/Add-Excel-in-PowerPoint-slide). -### Inserting OLE Object to a Slide with Display As Icon property +### `AddOleObject` Overloads -The following code example demonstrates how to add an Microsoft Word document into a slide with display as icon property. +| Overload | Description | +|----------|-------------| +| [`AddOleObject(Stream imageStream, string progId, Stream oleData)`](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IShapes.html#Syncfusion_Presentation_IShapes_AddOleObject_System_IO_Stream_System_String_System_IO_Stream_) |Creates an IOleObject instance with the specified image, program id, and data, then adds it to the IShapes collection. | +| [`AddOleObject(string imagePath, string progId, string pathLink)`[(https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IShapes.html#Syncfusion_Presentation_IShapes_AddOleObject_System_IO_Stream_System_String_System_String_) | Creates an IOleObject instance with the specified image, program id, and data, then adds it to the IShapes collection.| + +## Inserting an OLE Object into a Slide with the DisplayAsIcon Property + +The following code example demonstrates how to add a Microsoft Word document into a slide with the `DisplayAsIcon` property enabled. When `DisplayAsIcon` is `true`, the OLE object is rendered as an icon, and the embedded document opens in its default application when the icon is double-clicked. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/OLE-objects/Add-Microsoft-Word-document-in-slide/.NET/Add-Microsoft-Word-document-in-slide/Program.cs" %} -//Create new instance of PowerPoint presentation. +//Create a new instance of the PowerPoint presentation. IPresentation pptxDoc = Presentation.Create(); -//Add slide with blank layout to presentation +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Get the Word document file as stream FileStream wordDocumentStream = new FileStream("OleTemplate.docx", FileMode.Open); @@ -109,60 +132,59 @@ oleObject.Left = 10; oleObject.Top = 10; oleObject.Width = 400; oleObject.Height = 300; -//Set DisplayAsIcon as true, to open the embedded document in separate (default) application. +//Set DisplayAsIcon to true so the embedded document opens in its default application. oleObject.DisplayAsIcon = true; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("OleObjectSample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the presentation +//Save the PowerPoint presentation to a file. +pptxDoc.Save("OleObjectSample.pptx"); +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Create new instance of PowerPoint presentation. [Equivalent to launching MS PowerPoint with no slides]. +//Create a new instance of the PowerPoint presentation. IPresentation pptxDoc = Presentation.Create(); -//Add slide with blank layout to presentation +//Add a slide with a blank layout to the presentation. ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); -//Get the Word document file as stream +//Open the Word document as a stream. Stream wordDocumentStream = File.Open("OleTemplate.docx", FileMode.Open); -//Image to be displayed, This can be any image +//Image to be displayed. This can be any image. Stream imageStream = File.Open("OlePicture.png", FileMode.Open); -//Add an OLE object to the slide +//Add an OLE object to the slide. IOleObject oleObject = slide.Shapes.AddOleObject(imageStream, "Word.Document.12", wordDocumentStream); -//Set size and position of the OLE objectwordStream +//Set the size and position of the OLE object. oleObject.Left = 10; oleObject.Top = 10; oleObject.Width = 400; oleObject.Height = 300; -//Set DisplayAsIcon as true, to open the embedded document in separate (default) application. +//Set DisplayAsIcon to true so the embedded document opens in its default application. oleObject.DisplayAsIcon = true; -//Save the presentation +//Save the presentation. pptxDoc.Save("OleObjectSample.pptx"); -//Close the presentation +//Close the presentation. pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Create new instance of PowerPoint presentation. [Equivalent to launching MS PowerPoint with no slides]. +'Create a new instance of the PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Create() -'Add slide with blank layout to presentation +'Add a slide with a blank layout to the presentation. Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) -'Get the Word document file as stream +'Open the Word document as a stream. Dim wordDocumentStream As Stream = File.Open("OleTemplate.docx", FileMode.Open) -'Image to be displayed, This can be any image +'Image to be displayed. This can be any image. Dim imageStream As Stream = File.Open("OlePicture.png", FileMode.Open) -'Add an OLE object to the slide +'Add an OLE object to the slide. Dim oleObject As IOleObject = slide.Shapes.AddOleObject(imageStream, "Word.Document.12", wordDocumentStream) -'Set size and position of the OLE object +'Set the size and position of the OLE object. oleObject.Left = 10 oleObject.Top = 10 oleObject.Width = 400 oleObject.Height = 300 -'Set DisplayAsIcon as true, to open the embedded document in separate (default) application. +'Set DisplayAsIcon to true so the embedded document opens in its default application. oleObject.DisplayAsIcon = True -'Save the presentation +'Save the presentation. pptxDoc.Save("OleObjectSample.pptx") -'Close the presentation +'Close the presentation. pptxDoc.Close() {% endhighlight %} @@ -170,26 +192,24 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/OLE-objects/Add-Microsoft-Word-document-in-slide). -## Extract embedded OLE Object data +## Extracting Embedded OLE Object Data The following code example demonstrates how to extract the embedded OLE Object data. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/OLE-objects/Extract-embedded-OLE-Object-data/.NET/Extract-embedded-OLE-Object-data/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("EmbeddedOleObject.pptx", FileMode.Open); -//Opens the specified presentation -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide of the Presentation +//Open the specified PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 2 is used in this sample. IOleObject oleObject = slide.Shapes[2] as IOleObject; -//Gets the file data of embedded Ole Object +//Get the file data of the embedded OLE object. byte[] array = oleObject.ObjectData; -//Gets the file Name of OLE Object +//Get the file name of the OLE object. string outputFile = oleObject.FileName; -//Save the extracted Ole data into file system +//Save the extracted OLE data to the file system. MemoryStream memoryStream = new MemoryStream(array); FileStream fileStream = File.Create(outputFile); memoryStream.CopyTo(fileStream); @@ -200,17 +220,17 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens the specified presentation +//Open the specified PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); -//Gets the first slide of the Presentation +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 2 is used in this sample. IOleObject oleObject = slide.Shapes[2] as IOleObject; -//Gets the file data of embedded Ole Object +//Get the file data of the embedded OLE object. byte[] array = oleObject.ObjectData; -//Gets the file Name of OLE Object +//Get the file name of the OLE object. string outputFile = oleObject.FileName; -//Save the extracted Ole data into file system +//Save the extracted OLE data to the file system. MemoryStream memoryStream = new MemoryStream(array); FileStream fileStream = File.Create(outputFile); memoryStream.CopyTo(fileStream); @@ -222,62 +242,60 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens the specified presentation +'Open the specified PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("EmbeddedOleObject.pptx") -'Gets the first slide of the Presentation +'Get the first slide of the presentation. Dim slide As ISlide = pptxDoc.Slides(0) -'Gets the Ole Object of the slide -Dim oleObject As IOleObject = CType(slide.Shapes(2),IOleObject) -'Gets the file data of embedded Ole Object +'Get the OLE object from the slide. The shape index 2 is used in this sample. +Dim oleObject As IOleObject = CType(slide.Shapes(2), IOleObject) +'Get the file data of the embedded OLE object. Dim array() As Byte = oleObject.ObjectData -'Gets the file Name of OLE Object +'Get the file name of the OLE object. Dim outputFile As String = oleObject.FileName -'Save the extracted Ole data into file system +'Save the extracted OLE data to the file system. Dim memoryStream As MemoryStream = New MemoryStream(array) Dim fileStream As FileStream = File.Create(outputFile) memoryStream.CopyTo(fileStream) memoryStream.Dispose fileStream.Dispose 'Close the presentation -pptxDoc.Close +pptxDoc.Close() {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/OLE-objects/Extract-embedded-OLE-Object-data). -## Get file path of a linked OLE Object +## Getting the File Path of a Linked OLE Object The following code example demonstrates how to get the file path of a linked OLE Object. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/OLE-objects/Get-file-path-of-linked-OLE-Object/.NET/Get-file-path-of-linked-OLE-Object/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("EmbeddedOleObject.pptx", FileMode.Open); -//Opens the specified presentation -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide of the Presentation +//Open the specified PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 1 is used in this sample. IOleObject oleObject = slide.Shapes[1] as IOleObject; -//Gets the path of linked Ole Object +//Get the path of the linked OLE object. string linkOlePath = oleObject.LinkPath; //Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("OleObjectSample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +pptxDoc.Save("OleObjectSample.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens the specified presentation +//Open the specified PowerPoint presentation. IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); -//Gets the first slide of the Presentation +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 1 is used in this sample. IOleObject oleObject = slide.Shapes[1] as IOleObject; -//Gets the path of linked Ole Object + +//Get the path of the linked OLE object. string linkOlePath = oleObject.LinkPath; //Save the presentation pptxDoc.Save("OleObjectSample.pptx"); @@ -286,13 +304,13 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens the specified presentation +'Open the specified PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("EmbeddedOleObject.pptx") -'Gets the first slide of the Presentation +'Get the first slide of the presentation. Dim slide As ISlide = pptxDoc.Slides(0) -'Gets the Ole Object of the slide +'Get the OLE object from the slide. The shape index 1 is used in this sample. Dim oleObject As IOleObject = CType(slide.Shapes(1), IOleObject) -'Gets the path of linked Ole Object +'Get the path of the linked OLE object. Dim linkOlePath As String = oleObject.LinkPath 'Save the presentation pptxDoc.Save("OleObjectSample.pptx") @@ -304,24 +322,22 @@ pptxDoc.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/OLE-objects/Get-file-path-of-linked-OLE-Object). -## Get OLE Image data +## Getting the OLE Image Data The following code example demonstrates how to get the OLE image data. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/OLE-objects/Get-OLE-image-data/.NET/Get-OLE-image-data/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("EmbeddedOleObject.pptx", FileMode.Open); -//Opens the specified presentation -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide of the Presentation +//Open the specified PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 1 is used in this sample. IOleObject oleObject = slide.Shapes[1] as IOleObject; -//Gets the data of Ole Image +//Get the data of the OLE image. byte[] array = oleObject.ImageData; -//Save the extracted Ole data into file system +//Save the extracted OLE data to the file system as an EMF image. MemoryStream memoryStream = new MemoryStream(array); FileStream fileStream = File.Create("OleImage.emf"); memoryStream.CopyTo(fileStream); @@ -332,15 +348,15 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens the specified presentation -IPresentation pptxDoc = Presentation.Open("ImageEmbeddedOleObject.pptx"); -//Gets the first slide of the Presentation +//Open the specified PowerPoint presentation. +IPresentation pptxDoc = Presentation.Open("EmbeddedOleObject.pptx"); +//Get the first slide of the presentation. ISlide slide = pptxDoc.Slides[0]; -//Gets the Ole Object of the slide +//Get the OLE object from the slide. The shape index 1 is used in this sample. IOleObject oleObject = slide.Shapes[1] as IOleObject; -//Gets the data of Ole Image +//Get the data of the OLE image. byte[] array = oleObject.ImageData; -//Save the extracted Ole data into file system +//Save the extracted OLE data to the file system as an EMF image. MemoryStream memoryStream = new MemoryStream(array); //Extracted ole data saved as image FileStream fileStream = File.Create("OleImage.emf"); @@ -352,11 +368,11 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Opens the specified presentation +'Open the specified PowerPoint presentation. Dim pptxDoc As IPresentation = Presentation.Open("EmbeddedOleObject.pptx") -'Gets the first slide of the Presentation +'Get the first slide of the presentation. Dim slide As ISlide = pptxDoc.Slides(0) -'Gets the Ole Object of the slide +'Get the OLE object from the slide. The shape index 1 is used in this sample. Dim oleObject As IOleObject = CType(slide.Shapes(1), IOleObject) 'Gets the data of Ole Image Dim array() As Byte = oleObject.ImageData @@ -377,7 +393,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Online Demo -* Explore how to insert and extract an OLE Object in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/oleobject#/tailwind). +* Explore how to insert and extract an OLE object in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/oleobject#/tailwind). ## See Also * [How to replace all OLE objects with text in PowerPoint using C#?](https://support.syncfusion.com/kb/article/15653/how-to-replace-all-ole-objects-with-text-in-powerpoint-using-c) diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-headers-and-footers.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-headers-and-footers.md index dede50f413..2a81f7a3c4 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-headers-and-footers.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-headers-and-footers.md @@ -11,7 +11,7 @@ documentation: UG ### Add Footer to a Slide in PowerPoint -Essential® Presentation library facilitates adding [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) in a slide of the PowerPoint Presentation. Footers are useful in providing quick information about your document or data. +Essential® Presentation library facilitates adding [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) in a slide of the PowerPoint presentation. Footers are useful for providing quick information about your document or data. The following code example demonstrates how to add a footer to the presentation. @@ -34,9 +34,8 @@ IParagraph paragraph = textboxShape.TextBody.AddParagraph(); ITextPart textPart = paragraph.AddTextPart(); //Adds text to the TextPart textPart.Text = "AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -93,13 +92,13 @@ pptxDoc.Close() By executing the program, you will get the PowerPoint slide as follows. -![Added Footer text](HeaderFooter_Images/Footer_text.png) +![Added Footer text to the slide](HeaderFooter_Images/Footer_text.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Headers-and-Footers/Add-footer-in-PowerPoint). ### Add Date and Time in PowerPoint Slide -Essential® Presentation library facilitates adding Date and Time to a slide of the PowerPoint Presentation. Date and Time comes with formatting options for date stamp as either it can be updated automatically using computer's clock or stay fixed until you change it. +Essential® Presentation library facilitates adding Date and Time to a slide of the PowerPoint presentation. Date and Time come with formatting options for the date stamp, as either it can be updated automatically using the computer's clock or stay fixed until you change it. The following code example demonstrates how to add Date and Time to a slide of the presentation. @@ -112,7 +111,7 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Sets the visibility of Date and Time in the slide slide.HeadersFooters.DateAndTime.Visible = true; -//Sets the format of the Date and Time to the Footer +//Sets the format of the Date and Time slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimehmmssAMPM; //Adds textbox to the slide IShape textboxShape = slide.AddTextBox(0, 0, 500, 500); @@ -122,9 +121,8 @@ IParagraph paragraph = textboxShape.TextBody.AddParagraph(); ITextPart textPart = paragraph.AddTextPart(); //Adds text to the TextPart textPart.Text = "AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -138,7 +136,7 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Sets the visibility of Date and Time in the slide slide.HeadersFooters.DateAndTime.Visible = true; -//Sets the format of the Date and Time to the Footer +//Sets the format of the Date and Time slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimehmmssAMPM; //Adds textbox to the slide IShape textboxShape = slide.AddTextBox(0, 0, 500, 500); @@ -161,7 +159,7 @@ Dim pptxDoc As IPresentation = Presentation.Create() Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) 'Sets the visibility of Date and Time in the slide slide.HeadersFooters.DateAndTime.Visible = True -'Sets the format of the Date and Time to the Footer +'Sets the format of the Date and Time slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimehmmssAMPM 'Adds textbox to the slide Dim textboxShape As IShape = slide.AddTextBox(0, 0, 500, 500) @@ -181,15 +179,15 @@ pptxDoc.Close() By executing the program, you will get the PowerPoint slide as follows. -![Added Date and TIme to the slide](HeaderFooter_Images/AddDateTime.png) +![Added Date and Time to the slide](HeaderFooter_Images/AddDateTime.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Headers-and-Footers/Add-date-and-time-in-PowerPoint-slide). ### Add Slide Number to PowerPoint Slides -Essential® Presentation library facilitates adding Slide number to a slide of the PowerPoint Presentation. +Essential® Presentation library facilitates adding a Slide number to a slide of the PowerPoint presentation. -The following code example demonstrates how to add Slide number to a slide of the presentation. +The following code example demonstrates how to add a Slide number to a slide of the presentation. {% tabs %} @@ -208,9 +206,8 @@ IParagraph paragraph = textboxShape.TextBody.AddParagraph(); ITextPart textPart = paragraph.AddTextPart(); //Adds text to the TextPart textPart.Text = "AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -269,16 +266,15 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Add Footer to Master and Layout slides -Essential® Presentation library facilitates adding Footers to both master and layout slides of the PowerPoint Presentation. If you want to use a different format for the Footers, then a great way to apply the format to all the slides (existing and new slides) is using the Slide Master and Slide layout. Under Slide Master and Slide layout, you can control the styles for footer options and this way you can apply different styles to the slides, or re-locate the Footer shape to any other position based on your requirement +Essential® Presentation library facilitates adding Footers to both master and layout slides of the PowerPoint presentation. If you want to use a different format for the Footers, a great way to apply the format to all the slides (existing and new slides) is by using the Slide Master and Slide Layout. Under Slide Master and Slide Layout, you can control the styles for the footer and apply different styles to the slides, or relocate the Footer shape to any other position based on your requirement. -The following code example demonstrates how to add a Footers to the master and layout slides of the presentation. +The following code example demonstrates how to add a Footer to the master and layout slides of the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Add-footer-in-master-and-layout-slides/.NET/Add-footer-in-master-and-layout-slides/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Load or open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open(inputFileName); //Access the first master slide in PowerPoint file IMasterSlide masterSlide = pptxDoc.Masters[0]; //Sets the visibility of Footer content in the Master slide @@ -301,9 +297,8 @@ foreach(ILayoutSlide layoutSlide in masterSlide.LayoutSlides) //Sets the format of the DateTime Footer in Layout slide layoutSlide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeMMddyyhmmAMPM; } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -311,7 +306,7 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Load or open an PowerPoint Presentation +//Load or open a PowerPoint Presentation IPresentation pptxDoc = Presentation.Open("Footer.pptx"); //Access the first master slide in PowerPoint file IMasterSlide masterSlide = pptxDoc.Masters[0]; @@ -342,7 +337,7 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Load or open an PowerPoint Presentation +'Load or open a PowerPoint Presentation Dim pptxDoc As IPresentation = Presentation.Open("Footer.pptx") 'Access the first master slide in PowerPoint file Dim masterSlide As IMasterSlide = pptxDoc.Masters(0) @@ -366,7 +361,7 @@ For Each layoutSlide As ILayoutSlide In masterSlide.LayoutSlides layoutSlide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeMMddyyhmmAMPM Next 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -385,12 +380,12 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Add Headers and Footers into Notes slide -Essential® Presentation library facilitates adding Headers and Footers to the Notes slide of the PowerPoint Presentation. +Essential® Presentation library facilitates adding Headers and Footers to the Notes slide of the PowerPoint presentation. -N> 1. As per Microsoft PowerPoint behavior, you can add Header only in Notes slide of the PowerPoint using our Essential® Presentation Library. -N> 2. Header added in Notes slide will be visible only in the Notes page of the PowerPoint viewer. +N> 1. As per Microsoft PowerPoint behavior, you can add a Header only in the Notes slide of the PowerPoint using our Essential® Presentation Library. +N> 2. The Header added in a Notes slide will be visible only in the Notes page of the PowerPoint viewer. -The following code example demonstrates how to add a Headers and Footers to the Notes slide of the presentation. +The following code example demonstrates how to add Headers and Footers to the Notes slide of the presentation. {% tabs %} @@ -413,9 +408,8 @@ notesSlide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeMMMyy; notesSlide.HeadersFooters.Footer.Visible = true; //Sets the text to be added to the Footer of the Notes slide notesSlide.HeadersFooters.Footer.Text = "Notes slide Footer"; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -467,7 +461,7 @@ notesSlide.HeadersFooters.Footer.Visible = True 'Sets the text to be added to the Footer of the Notes slide notesSlide.HeadersFooters.Footer.Text = "Notes slide Footer" 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -484,23 +478,21 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Edit Footer text of an existing Slide -Essential® Presentation library facilitates editing the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) text of an existing slide in the PowerPoint Presentation. +Essential® Presentation library facilitates editing the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) text of an existing slide in the PowerPoint presentation. -The following code example demonstrates how to edit [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) text of an existing slide in the presentation. +The following code example demonstrates how to edit the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) text of an existing slide in the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Edit-footer-text/.NET/Edit-footer-text/Program.cs" %} -//Load or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide from the cloned PowerPoint presentation +//Load or open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open(inputFileName); +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; //Modify the Footer text -slide.HeadersFooters.Footer.Text = "Footer content modified"; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +slide.HeadersFooters.Footer.Text = "Footer content modified"; +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -508,9 +500,9 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Load or open an PowerPoint Presentation +//Load or open a PowerPoint Presentation IPresentation pptxDoc = Presentation.Open("Footer.pptx"); -//Gets the first slide from the cloned PowerPoint presentation +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; //Modify the Footer text slide.HeadersFooters.Footer.Text = "Footer content modified"; @@ -521,14 +513,14 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Load or open an PowerPoint Presentation +'Load or open a PowerPoint Presentation Dim pptxDoc As IPresentation = Presentation.Open("Footer.pptx") 'Gets the first slide from the PowerPoint presentation -ISlide slide = pptxDoc.Slides[0] +Dim slide As ISlide = pptxDoc.Slides(0) 'Modify the Footer text slide.HeadersFooters.Footer.Text = "Footer content modified" 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -543,50 +535,49 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Edit Header text of an existing Notes slide -Essential® Presentation library facilitates editing of Headers for the Notes slide of the PowerPoint Presentation. +Essential® Presentation library facilitates editing of Headers for the Notes slide of the PowerPoint presentation. -N> 1. As per Microsoft PowerPoint behavior, you can edit Header only in Notes slide of the PowerPoint using our Essential® Presentation Library. -N> 2. Header edited in Notes slide will be visible only in the Notes page of the PowerPoint viewer. +N> 1. As per Microsoft PowerPoint behavior, you can edit a Header only in the Notes slide of the PowerPoint using our Essential® Presentation Library. +N> 2. The Header edited in a Notes slide will be visible only in the Notes page of the PowerPoint viewer. The following code example demonstrates how to edit the Headers for the Notes slide of the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Edit-header-text/.NET/Edit-header-text/Program.cs" %} -//Open a PowerPoint presentation. -IPresentation pptxDoc = Presentation.Open("Header.pptx"); -//Get the notes slide from the presenatation. -INotesSlide notesSlide = pptxDoc.Slides[0].NotesSlide; -//Modify the existing content of the header. -notesSlide.HeadersFooters.Header.Text = "Header content is modified"; -//Save the PowerPoint Presentation as stream. -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); -//Close the Presentation. +//Open a PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("Header.pptx"); +//Get the notes slide from the presentation +INotesSlide notesSlide = pptxDoc.Slides[0].NotesSlide; +//Modify the existing content of the header +notesSlide.HeadersFooters.Header.Text = "Header content is modified"; +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); +//Close the Presentation pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Open a PowerPoint presentation. -IPresentation pptxDoc = Presentation.Open("Header.pptx"); -//Get the notes slide from the presenatation. -INotesSlide notesSlide = pptxDoc.Slides[0].NotesSlide; -//Modify the existing content of the header. -notesSlide.HeadersFooters.Header.Text = "Header content is modified"; -//Save the modified PowerPoint presentation. -pptxDoc.Save("Result.pptx"); -//Close the Presentation. -pptxDoc.Close(); +//Open a PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("Header.pptx"); +//Get the notes slide from the presentation +INotesSlide notesSlide = pptxDoc.Slides[0].NotesSlide; +//Modify the existing content of the header +notesSlide.HeadersFooters.Header.Text = "Header content is modified"; +//Saves the Presentation to the file system +pptxDoc.Save("Result.pptx"); +//Close the Presentation +pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Open a PowerPoint presentation. +'Open a PowerPoint presentation Dim pptxDoc As IPresentation = Presentation.Open("Header.pptx") -'Get the notes slide from the presenatation. +'Get the notes slide from the presentation Dim notesSlide As INotesSlide = pptxDoc.Slides(0).NotesSlide -'Modify the existing content of the header. +'Modify the existing content of the header notesSlide.HeadersFooters.Header.Text = "Header content is modified" -'Save the modified PowerPoint presentation. +'Saves the Presentation to the file system pptxDoc.Save("Result.pptx") 'Close the Presentation pptxDoc.Close() @@ -602,23 +593,21 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Modify Date and Time format of an existing Slide -Essential® Presentation library facilitates modifying the Date and Time of an existing slide in the PowerPoint Presentation. +Essential® Presentation library facilitates modifying the Date and Time format of an existing slide in the PowerPoint presentation. -The following code example demonstrates how to modify Date and Time of an existing slide in the presentation. +The following code example demonstrates how to modify the Date and Time format of an existing slide in the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Modify-date-and-time-format/.NET/Modify-date-and-time-format/Program.cs" %} -//Load or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide from the cloned PowerPoint presentation +//Load or open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open(inputFileName); +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; -//Modify Date and Time format of the Footer -slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeddddMMMMddyyyy; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Modify the Date and Time format +slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeddddMMMMddyyyy; +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -626,11 +615,11 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Load or open an PowerPoint Presentation +//Load or open a PowerPoint Presentation IPresentation pptxDoc = Presentation.Open("Footer.pptx"); -//Gets the first slide from the cloned PowerPoint presentation +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; -//Modify Date and Time format of the Footer +//Modify the Date and Time format slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeddddMMMMddyyyy; //Saves the Presentation to the file system pptxDoc.Save("Sample.pptx"); @@ -639,14 +628,14 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Load or open an PowerPoint Presentation +'Load or open a PowerPoint Presentation Dim pptxDoc As IPresentation = Presentation.Open("Footer.pptx") 'Gets the first slide from the PowerPoint presentation -ISlide slide = pptxDoc.Slides[0] -'Modify Date and Time format of the Footer +Dim slide As ISlide = pptxDoc.Slides(0) +'Modify the Date and Time format slide.HeadersFooters.DateAndTime.Format = DateTimeFormatType.DateTimeddddMMMMddyyyy 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -661,17 +650,16 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Modify font of the Footer text -Essential® Presentation library facilitates editing font of the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) content in slide of the PowerPoint Presentation. +Essential® Presentation library facilitates editing the font of the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) content in a slide of the PowerPoint presentation. -The following code example demonstrates how to edit font of the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) content in slide of the presentation. +The following code example demonstrates how to edit the font of the [Footer](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IHeadersFooters.html#Syncfusion_Presentation_IHeadersFooters_Footer) content in a slide of the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Modify-footer-text-font/.NET/Modify-footer-text-font/Program.cs" %} -//Load or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Gets the first slide from the cloned PowerPoint presentation +//Load or open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open(inputFileName); +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; //Iterate each shape in slide foreach(IShape shape in slide.Shapes) @@ -685,9 +673,8 @@ foreach(IShape shape in slide.Shapes) shape.TextBody.Paragraphs[0].Font.FontSize = 18; } } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -695,9 +682,9 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Load or open an PowerPoint Presentation +//Load or open a PowerPoint Presentation IPresentation pptxDoc = Presentation.Open("Footer.pptx"); -//Gets the first slide from the cloned PowerPoint presentation +//Gets the first slide from the PowerPoint presentation ISlide slide = pptxDoc.Slides[0]; //Iterate each shape in slide foreach(IShape shape in slide.Shapes) @@ -718,10 +705,10 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Load or open an PowerPoint Presentation +'Load or open a PowerPoint Presentation Dim pptxDoc As IPresentation = Presentation.Open("Footer.pptx") 'Gets the first slide from the PowerPoint presentation -ISlide slide = pptxDoc.Slides[0] +Dim slide As ISlide = pptxDoc.Slides(0) 'Iterate each shape in slide For Each shape As IShape In slide.Shapes 'Check whether the shape is with Placeholder SlideItemType and PlaceholderType as Footer @@ -733,7 +720,7 @@ For Each shape As IShape In slide.Shapes End If Next 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -748,16 +735,15 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Remove Headers and Footers from Title Slides -Essential® Presentation library facilitates removing Footers from all the [Title](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.SlideLayoutType.html) slides in the PowerPoint Presentation. +Essential® Presentation library facilitates removing Footers, Date/Time, and Slide Number from all the [Title](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.SlideLayoutType.html) slides in the PowerPoint presentation. -The following code example demonstrates how to remove Footers from all the [Title](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.SlideLayoutType.html) slides in the presentation. +The following code example demonstrates how to remove Footers, Date/Time, and Slide Number from all the [Title](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.SlideLayoutType.html) slides in the presentation. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Headers-and-Footers/Remove-footers-from-all-title-slides/.NET/Remove-footers-from-all-title-slides/Program.cs" %} -//Load or open an PowerPoint Presentation -FileStream inputStream = new FileStream(inputFileName,FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Load or open a PowerPoint Presentation +IPresentation pptxDoc = Presentation.Open(inputFileName); //Iterate each slide in the Presentation foreach(ISlide slide in pptxDoc.Slides) @@ -765,17 +751,16 @@ foreach(ISlide slide in pptxDoc.Slides) //Checks whether the LayoutType of Layout slide is Title if (slide.LayoutSlide.LayoutType == SlideLayoutType.Title) { - //Sets the visibility of DateAndTime in the Title slide + //Sets the visibility of DateAndTime in the Title slide slide.HeadersFooters.DateAndTime.Visible = false; - //Sets the visibility of Footer in the Title slide + //Sets the visibility of Footer in the Title slide slide.HeadersFooters.Footer.Visible = false; - //Sets the visibility of SlideNumber in the Title slide + //Sets the visibility of SlideNumber in the Title slide slide.HeadersFooters.SlideNumber.Visible = false; } } -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the Presentation to the file system +pptxDoc.Save("Sample.pptx"); //Dispose the image stream pictureStream.Dispose(); //Closes the Presentation @@ -783,7 +768,7 @@ pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Load or open an PowerPoint Presentation +//Load or open a PowerPoint Presentation IPresentation pptxDoc = Presentation.Open("Footer.pptx"); //Iterate each slide in the Presentation foreach(ISlide slide in pptxDoc.Slides) @@ -791,11 +776,11 @@ foreach(ISlide slide in pptxDoc.Slides) //Checks whether the LayoutType of Layout slide is Title if (slide.LayoutSlide.LayoutType == SlideLayoutType.Title) { - //Sets the visibility of DateAndTime in the Title slide + //Sets the visibility of DateAndTime in the Title slide slide.HeadersFooters.DateAndTime.Visible = false; - //Sets the visibility of Footer in the Title slide + //Sets the visibility of Footer in the Title slide slide.HeadersFooters.Footer.Visible = false; - //Sets the visibility of SlideNumber in the Title slide + //Sets the visibility of SlideNumber in the Title slide slide.HeadersFooters.SlideNumber.Visible = false; } } @@ -806,7 +791,7 @@ pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Load or open an PowerPoint Presentation +'Load or open a PowerPoint Presentation Dim pptxDoc As IPresentation = Presentation.Open("Footer.pptx") 'Iterate each slide in the Presentation For Each slide As ISlide In pptxDoc.Slides @@ -814,14 +799,14 @@ For Each slide As ISlide In pptxDoc.Slides If slide.LayoutSlide.LayoutType = SlideLayoutType.Title Then 'Sets the visibility of DateAndTime in the Title slide slide.HeadersFooters.DateAndTime.Visible = False - 'Sets the visibility of Footer in the Title slide + 'Sets the visibility of Footer in the Title slide slide.HeadersFooters.Footer.Visible = False - 'Sets the visibility of SlideNumber in the Title slide + 'Sets the visibility of SlideNumber in the Title slide slide.HeadersFooters.SlideNumber.Visible = False End If Next 'Saves the Presentation to the file system -pptxDoc.Save("Sample.pptx +pptxDoc.Save("Sample.pptx") 'Closes the Presentation pptxDoc.Close() {% endhighlight %} @@ -830,10 +815,16 @@ pptxDoc.Close() By executing the program, you will get the PowerPoint slide as follows. -![Removed Footers from Title Slide](HeaderFooter_Images/TitleSlide.png) +![Removed Footers, Date/Time, and Slide Number from Title Slide](HeaderFooter_Images/TitleSlide.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Headers-and-Footers/Remove-footers-from-all-title-slides). ## Online Demo -* Explore how to insert headers and footers in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/headerandfooter#/tailwind). \ No newline at end of file +* Explore how to insert headers and footers in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/headerandfooter#/tailwind). + +## See Also + +* [Syncfusion Presentation NuGet package](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet/) +* [Loading and Saving the Presentation](Loading-and-Saving-the-Presentation) +* [NuGet Packages Required](NuGet-Packages-Required) \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-sections.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-sections.md index 3b643c4620..71b06eddfc 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-sections.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/Working-with-sections.md @@ -10,7 +10,7 @@ keywords: sections in PowerPoint presentation [Sections](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentation.html#Syncfusion_Presentation_IPresentation_Sections) helps to manage the slides of a PowerPoint presentation. If a presentation has many slides, you can organize the slides using sections to make the navigation easier. -## Creating a section +## Creating a section ### Adding a new slide to a section @@ -29,9 +29,10 @@ section.Name = "SectionDemo"; ISlide slide = section.AddSlide(SlideLayoutType.Blank); //Adds a text box to the slide slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo"); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -46,7 +47,7 @@ ISlide slide = section.AddSlide(SlideLayoutType.Blank); //Adds a text box to the slide slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo"); //Saves the PowerPoint presentation -pptxDoc.Save("Section.pptx"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -61,7 +62,7 @@ Dim slide As ISlide = section.AddSlide(SlideLayoutType.Blank) 'Adds a text box to the slide slide.AddTextBox(10, 10, 100, 100).TextBody.AddParagraph("Slide in SectionDemo") 'Saves the PowerPoint presentation -pptxDoc.Save("Section.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} @@ -76,15 +77,15 @@ The following code example demonstrates how to add an existing slide to a sectio {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Add-existing-slide-in-PowerPoint-section/.NET/Add-existing-slide-in-PowerPoint-section/Program.cs" %} //Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Creates a new section in the PowerPoint presentation pptxDoc.Sections.Add(); //Moves the first slide to the created section pptxDoc.Slides[0].MoveToSection(0); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -95,7 +96,7 @@ pptxDoc.Sections.Add(); //Moves the first slide to the created section pptxDoc.Slides[0].MoveToSection(0); //Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -106,7 +107,7 @@ pptxDoc.Sections.Add() 'Moves the first slide to the created section pptxDoc.Slides(0).MoveToSection(0) 'Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} @@ -124,15 +125,16 @@ The following code example demonstrates how to insert a section in a template Po IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Create a new section to Insert. ISection section = pptxDoc.Sections.Add(); -//Name the created section. +//Names the created section. section.Name = "InsertedSection"; //Insert the section at second position. pptxDoc.Sections.Insert(1, section); //Remove the unwanted created section. pptxDoc.Sections.RemoveAt(pptxDoc.Sections.Count - 1); -//Save the PowerPoint Presentation as stream. -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -140,14 +142,14 @@ pptxDoc.Save(outputStream); IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Create a new section to Insert. ISection section = pptxDoc.Sections.Add(); -//Name the created section. +//Names the created section. section.Name = "InsertedSection"; //Insert the section at second position. pptxDoc.Sections.Insert(1, section); -//Remove the unwanted created section. +//Removes the unwanted section appended by Add() (now duplicated at the end). pptxDoc.Sections.RemoveAt(pptxDoc.Sections.Count - 1); -//Save the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -155,14 +157,14 @@ pptxDoc.Save("Sections.PPTX"); Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") 'Create a new section to Insert. Dim section As ISection = pptxDoc.Sections.Add() -'Name the created section. +'Names the created section. section.Name = "InsertedSection" 'Insert the section at second position. pptxDoc.Sections.Insert(1, section) 'Remove the unwanted created section. pptxDoc.Sections.RemoveAt(pptxDoc.Sections.Count - 1) -'Save the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +'Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} @@ -177,13 +179,13 @@ You can move the sections within a PowerPoint presentation. The following code e {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Move-section-positions/.NET/Move-section-positions/Program.cs" %} //Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Moves the second section to third position within the PowerPoint presentation. pptxDoc.Sections[2].Move(3); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -192,7 +194,7 @@ IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Moves the second section to third position within the PowerPoint presentation. pptxDoc.Sections[2].Move(3); //Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -201,7 +203,7 @@ Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") 'Moves the second section to third position within the PowerPoint presentation. pptxDoc.Sections(2).Move(3) 'Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} @@ -217,14 +219,15 @@ The following code example demonstrates how to move a slide from one section to {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Move-slide-within-section/.NET/Move-slide-within-section/Program.cs" %} //Loads or open an PowerPoint Presentation FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Gets the first slide of second section in the PowerPoint presentation ISlide slide = pptxDoc.Sections[1].Slides[0]; -//Moves the slide to first section +//Moves the slide to the first section slide.MoveToSection(0); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -232,10 +235,10 @@ pptxDoc.Save(outputStream); IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Gets the first slide of second section in the PowerPoint presentation ISlide slide = pptxDoc.Sections[1].Slides[0]; -//Moves the slide to first section +//Moves the slide to the first section slide.MoveToSection(0); //Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -243,17 +246,17 @@ pptxDoc.Save("Sections.PPTX"); Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") 'Gets the first slide of second section in the PowerPoint presentation Dim slide As ISlide = pptxDoc.Sections(1).Slides(0) -'Moves the slide to first section +'Moves the slide to the first section slide.MoveToSection(0) 'Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Sections/Move-slide-within-section). -## Cloning and merging the slides in a section +## Cloning slides from a section The following code example demonstrates how to clone the slide collection of a section and add those slides to a destination presentation. @@ -262,67 +265,69 @@ The following code example demonstrates how to clone the slide collection of a s {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Clone-and-merge-section-slides/.NET/Clone-and-merge-section-slides/Program.cs" %} //Loads or open an PowerPoint Presentation FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Clones the slides in 3rd section ISlides slides = pptxDoc.Sections[2].Clone(); //Creates a destination PowerPoint presentation instance. Existing presentations can also be used here. -pptxDoc = Presentation.Create(); -//Iterates the cloned slides and adds the slides to the destination presentation +IPresentation destinationPptx = Presentation.Create(); +//Iterates the cloned slides and adds them to the destination presentation foreach (ISlide slide in slides) - pptxDoc.Slides.Add(slide); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); + destinationPptx.Slides.Add(slide); +//Saves the destination PowerPoint presentation +destinationPptx.Save("Output.pptx"); +//Closes the PowerPoint presentations +sourcePptx.Close(); +destinationPptx.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Loads a PowerPoint presentation -IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); -//Clones the slides in 3rd section -ISlides slides = pptxDoc.Sections[2].Clone(); +//Loads the source PowerPoint presentation +IPresentation sourcePptx = Presentation.Open("PPTXWithSections.PPTX"); +//Clones the slides in the third section +ISlides slides = sourcePptx.Sections[2].Clone(); //Creates a destination PowerPoint presentation instance. Existing presentations can also be used here. -pptxDoc = Presentation.Create(); -//Iterates the cloned slides and adds the slides to the destination presentation +IPresentation destinationPptx = Presentation.Create(); +//Iterates the cloned slides and adds them to the destination presentation foreach (ISlide slide in slides) - pptxDoc.Slides.Add(slide); -//Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); + destinationPptx.Slides.Add(slide); +//Saves the destination PowerPoint presentation +destinationPptx.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Loads a PowerPoint presentation -Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") -'Clones the slides in 3rd section -Dim slides As ISlides = pptxDoc.Sections(2).Clone() +'Loads the source PowerPoint presentation +Dim sourcePptx As IPresentation = Presentation.Open("PPTXWithSections.PPTX") +'Clones the slides in the third section +Dim slides As ISlides = sourcePptx.Sections(2).Clone() 'Creates a destination PowerPoint presentation instance. Existing presentations can also be used here. -pptxDoc = Presentation.Create() -'Iterates the cloned slides and adds the slides to the destination presentation +Dim destinationPptx As IPresentation = Presentation.Create() +'Iterates the cloned slides and adds them to the destination presentation For Each slide As ISlide In slides - pptxDoc.Slides.Add(slide) + destinationPptx.Slides.Add(slide) Next -'Save the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +'Saves the destination PowerPoint presentation +destinationPptx.Save("Output.pptx") {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Sections/Clone-and-merge-section-slides). -## Removing a section +## Removing a section -The following code example demonstrates how to create remove a particular section from the sections collection of a presentation. +The following code example demonstrates how to remove a particular section from the sections collection of a presentation. Removing a section does not delete the slides it contains; the slides are moved to the default (unnamed) section. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Remove-section/.NET/Remove-section/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Loads a PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Removes the second section from the PowerPoint presentation pptxDoc.Sections.Remove(pptxDoc.Sections[1]); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Section.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -331,7 +336,7 @@ IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); //Removes the second section from the PowerPoint presentation pptxDoc.Sections.Remove(pptxDoc.Sections[1]); //Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -340,46 +345,46 @@ Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") 'Removes the second section from the PowerPoint presentation pptxDoc.Sections.Remove(pptxDoc.Sections(1)) 'Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Sections/Remove-section). -## Remove all sections +## Remove all sections -The following code example demonstrates how to remove section collection from an existing PowerPoint presentation. +The following code example demonstrates how to remove the section collection from an existing PowerPoint presentation. All slides remain in the presentation as part of the default (unnamed) section. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Sections/Remove-all-sections/.NET/Remove-all-sections/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("PPTXWithSections.PPTX",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); -//Removes the sections +//Loads a PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); +//Removes all sections from the PowerPoint presentation pptxDoc.Sections.Clear(); -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sections.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Saves the PowerPoint presentation +pptxDoc.Save("Output.pptx"); +//Closes the PowerPoint presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads a PowerPoint presentation IPresentation pptxDoc = Presentation.Open("PPTXWithSections.PPTX"); -//Removes the sections +//Removes all sections from the PowerPoint presentation pptxDoc.Sections.Clear(); //Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX"); +pptxDoc.Save("Output.pptx"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads a PowerPoint presentation Dim pptxDoc As IPresentation = Presentation.Open("PPTXWithSections.PPTX") -'Removes the sections +'Removes all sections from the PowerPoint presentation pptxDoc.Sections.Clear() 'Saves the PowerPoint presentation -pptxDoc.Save("Sections.PPTX") +pptxDoc.Save("Output.pptx") {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-connectors-in-powerpoint-slides-cs-vb-net.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-connectors-in-powerpoint-slides-cs-vb-net.md index 1aaff5e69a..85f98a759a 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-connectors-in-powerpoint-slides-cs-vb-net.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-connectors-in-powerpoint-slides-cs-vb-net.md @@ -1,5 +1,5 @@ --- -title: Add and edit connectors in PowerPoint slides | Syncfusion | +title: Add, edit, and remove connectors in PowerPoint slides description: Code examples to create and edit PowerPoint connectors in .NET, C#, web, ASP.NET, UWP, MVC, Xamarin and .NET Core platform: document-processing control: Syncfusion® PowerPoint presentation @@ -7,11 +7,9 @@ documentation: keywords: PowerPoint, slide, connectors, pptx, shapes --- -# Adding connectors in PowerPoint slides +# Adding, editing, and removing connectors in PowerPoint slides -Essential® Presentation library supports adding, editing, and removing the connectors in a PowerPoint file. The following code example demonstrates how to add a connector between two shapes. - -The following code example demonstrates how to add a connector in PowerPoint slide. +Essential® Presentation library supports adding, editing, and removing connectors in a PowerPoint file. The following code example demonstrates how to add a connector between two shapes. {% tabs %} @@ -26,9 +24,8 @@ using (IPresentation pptxDoc = Presentation.Create()) IShape oval = slide.Shapes.AddShape(AutoShapeType.Oval, 400, 10, 100, 100); //Add elbow connector on the slide and connect the end points of connector with specified port positions 0 and 4 of the beginning and end shapes IConnector connector = slide.Shapes.AddConnector(ConnectorType.Elbow, rectangle, 0, oval, 4); - //Save the PowerPoint Presentation as stream - FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); - pptxDoc.Save(outputStream); + //Save the PowerPoint file + pptxDoc.Save("Sample.pptx"); } {% endhighlight %} @@ -71,7 +68,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Adding a single point connector -You can also add a connector to a source shape without any destination shapes. The following code example demonstrates how to add a connector with single point connection. +You can also add a connector with only one end connected to a source shape, while the other end remains free. The following code example demonstrates how to add a single point connector. {% tabs %} @@ -94,9 +91,8 @@ using (IPresentation pptxDoc = Presentation.Create()) connector.LineFormat.Fill.FillType = FillType.Solid; //Set the connector solid fill as black connector.LineFormat.Fill.SolidFill.Color = ColorObject.Black; - //Save the PowerPoint Presentation as stream - FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); - pptxDoc.Save(outputStream); + //Save the PowerPoint file + pptxDoc.Save("Sample.pptx"); } {% endhighlight %} @@ -158,10 +154,8 @@ The following code example demonstrates how to edit an existing connector in a P {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Connectors/Modify-existing-connector/.NET/Modify-existing-connector/Program.cs" %} -//Loads an PowerPoint file in stream -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); //Opens the loaded PowerPoint file -using (IPresentation pptxDoc = Presentation.Open(inputStream)) +using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) { //Get the first slide of a PowerPoint file ISlide slide = pptxDoc.Slides[0]; @@ -171,19 +165,18 @@ using (IPresentation pptxDoc = Presentation.Open(inputStream)) connector.LineFormat.BeginArrowheadStyle = ArrowheadStyle.ArrowOpen; //Set the line format for the connector connector.LineFormat.DashStyle = LineDashStyle.DashDotDot; - //Disconnect the end connection of the connector if end point get connected + //Disconnect the end connection of the connector if end point gets connected if (connector.EndConnectedShape != null) connector.EndDisconnect(); //Insert a triangle shape into slide IShape triangle = slide.Shapes.AddShape(AutoShapeType.IsoscelesTriangle, 600, 500, 150, 150); //Declare the end connection site index int connectionSiteIndex = 4; - //Reconnect the end point of connector with triangle shape if its connection site count is greater than 4 + //Reconnect the end point of the connector with the triangle if the triangle has enough connection sites if (connectionSiteIndex < triangle.ConnectionSiteCount) connector.EndConnect(triangle, connectionSiteIndex); - //Save the PowerPoint Presentation as stream - FileStream outputStream = new FileStream("Connector.pptx", FileMode.Create); - pptxDoc.Save(outputStream); + //Save the PowerPoint file + pptxDoc.Save("Connector.pptx"); } {% endhighlight %} @@ -218,7 +211,7 @@ using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) ' Open an existing PowerPoint file. Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx") 'Get the first slide of a PowerPoint file - Dim slide As ISlide = pptxDoc.Slides(2) + Dim slide As ISlide = pptxDoc.Slides(0) 'Get the connector from a slide Dim connector As IConnector = CType(slide.Shapes(2), IConnector) 'Set the beginning cap for the connector @@ -233,7 +226,7 @@ Using pptxDoc As IPresentation = Presentation.Open("Sample.pptx") Dim triangle As IShape = slide.Shapes.AddShape(AutoShapeType.IsoscelesTriangle, 600, 500, 150, 150) 'Declare the end connection site index Dim connectionSiteIndex As Integer = 4 - 'Reconnect the end point of connector with triangle shape if its connection site count is greater than 4 + 'Reconnect the end point of the connector with the triangle if the triangle has enough connection sites If (connectionSiteIndex < triangle.ConnectionSiteCount) Then connector.EndConnect(triangle, connectionSiteIndex) End If @@ -253,10 +246,8 @@ The following code example demonstrates how to update a connector’s position w {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Connectors/Update-connector-position/.NET/Update-connector-position/Program.cs" %} -//Loads an PowerPoint file in stream -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); //Opens the loaded PowerPoint file -using (IPresentation pptxDoc = Presentation.Open(inputStream)) +using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) { //Get the first slide of a PowerPoint file ISlide slide = pptxDoc.Slides[0]; @@ -267,11 +258,10 @@ using (IPresentation pptxDoc = Presentation.Open(inputStream)) //Change the X and Y position of the rectangle rectangle.Left = 600; rectangle.Top = 200; - //Update the connector to connect with previously updated shape + //Update the connector to reflect the new shape position connector.Update(); - //Save the PowerPoint Presentation as stream - FileStream outputStream = new FileStream("Connector.pptx", FileMode.Create); - pptxDoc.Save(outputStream); + //Save the PowerPoint file + pptxDoc.Save("Connector.pptx"); } {% endhighlight %} @@ -325,20 +315,17 @@ The following code example demonstrates how to remove a connector from PowerPoin {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Connectors/Remove-connector-from-shapes/.NET/Remove-connector-from-shapes/Program.cs" %} -//Loads an PowerPoint file in stream -FileStream inputStream = new FileStream("Sample.pptx", FileMode.Open); //Opens the loaded PowerPoint file -using (IPresentation pptxDoc = Presentation.Open(inputStream)) +using (IPresentation pptxDoc = Presentation.Open("Sample.pptx")) { //Get the first slide of a PowerPoint file - ISlide slide = pptxDoc.Slides[0]; + ISlide slide = pptxDoc.Slides[0]; //Get the connector from a slide IConnector connector = slide.Shapes[2] as IConnector; //Remove the connector from slide slide.Shapes.Remove(connector); - //Save the PowerPoint Presentation as stream - FileStream outputStream = new FileStream("Connector.pptx", FileMode.Create); - pptxDoc.Save(outputStream); + //Save the PowerPoint file + pptxDoc.Save("Connector.pptx"); } {% endhighlight %} diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-slide-transitions-in-powerpoint-presentation-slides-cs-vb-net.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-slide-transitions-in-powerpoint-presentation-slides-cs-vb-net.md index 53686a9767..cf2c1550fe 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-slide-transitions-in-powerpoint-presentation-slides-cs-vb-net.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/create-edit-slide-transitions-in-powerpoint-presentation-slides-cs-vb-net.md @@ -9,17 +9,17 @@ keywords: PowerPoint, slide, format-table, pptx, transitions # Add and edit transitions in PowerPoint slides -Slide transitions are the motion effects that occur when you move from one slide to the next during a slide show presentation. A transition can be simple as push type that pushes to the next slide or an airplane type that displays the next slide like an eye-catching effect. You can control the speed, add sound, and customize the properties of transition effects. Transition effects can be grouped into three categories. +Slide transitions are the motion effects that occur when you move from one slide to the next during a slide show presentation. A transition can be as simple as a Push transition that moves to the next slide, or as eye-catching as an Airplane transition that animates the next slide in. You can control the speed, add sound, and customize the properties of transition effects. Transition effects can be grouped into three categories. 1. Subtle 2. Exciting 3. Dynamic Content -Transition effect contains the following properties. This makes slide transition more flexible and interactive.  - -1. Start (after a click or after certain time) -2. Duration -3. Speed +Transition effects have the following properties. These make slide transitions more flexible and interactive. + +1. Start (after a click or after a certain time) +2. Duration +3. Speed ## Set a transition effect to a PowerPoint slide @@ -34,13 +34,12 @@ IPresentation pptxDoc = Presentation.Create(); ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); //Add a shape to the slide IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300); -//Set the transition effect type +//Set the transition effect type slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; //Set the transition effect options slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Across; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream(OutputFileName, FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Sample.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} @@ -90,18 +89,16 @@ You can edit the transition effects that already applied to the PowerPoint slide {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PowerPoint-Examples/master/Slide-transitions/Modify-transition-effect/.NET/Modify-transition-effect/Program.cs" %} -//Loads or open an PowerPoint Presentation -FileStream inputStream = new FileStream("Sample.pptx",FileMode.Open); -IPresentation pptxDoc = Presentation.Open(inputStream); +//Open an existing PowerPoint presentation +IPresentation pptxDoc = Presentation.Open("Sample.pptx"); //Retrieve the first slide from the presentation ISlide slide = pptxDoc.Slides[0]; //Modify the transition effect applied to the slide slide.SlideTransition.TransitionEffect = TransitionEffect.Cover; //Set the transition subtype slide.SlideTransition.TransitionEffectOption = TransitionEffectOption.Right; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Transition.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Transition.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} @@ -157,9 +154,8 @@ IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300); slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; // Set the duration in seconds for the transition effect. Maximum duration value is 59 seconds slide.SlideTransition.Duration = 40; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Transition.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Transition.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} @@ -188,9 +184,9 @@ Dim pptxDoc As IPresentation = Presentation.Create() Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank) 'Add a shape to the slide Dim cubeShape As IShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300) -'Add a shape to the slide +'Set the transition effect type slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard -'Set the duration value(sec) for the transition effect. Max duration value is 59 seconds +'Set the duration value (in seconds) for the transition effect. Maximum duration value is 59 seconds slide.SlideTransition.Duration = 40 'Save the presentation pptxDoc.Save("Transition.pptx") @@ -204,7 +200,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Set the transition delay -You can set the transition delay in seconds. This delays the next transactions to happen for a certain number of seconds. The following example demonstrates how to apply the time delay. +You can set the transition delay in seconds. This delays the next transition by the specified number of seconds. The following example demonstrates how to apply the time delay. {% tabs %} @@ -221,9 +217,8 @@ slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; slide.SlideTransition.TriggerOnTimeDelay = true; //Assign the value for the advance time delay in seconds slide.SlideTransition.TimeDelay = 5; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Sample.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} @@ -272,10 +267,10 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Set the trigger mode for the transition -The next slide transition can be triggered by the following two ways: +The next slide transition can be triggered in the following two ways: -1. Mouse clicks - Brings the next slide to the view. -2. Setting a time - Brings the next slide after that specified time without any interactions. +1. **On mouse click** - Advances to the next slide when the user clicks. +2. **After a specified time** - Advances to the next slide automatically after the specified time, without any user interaction. The [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) allows you to set both the previously given trigger modes while using PowerPoint slide transitions. Refer to the following code example. @@ -292,9 +287,8 @@ IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300); slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; //Set transition advance on click to true. This will enable the next transition after a click slide.SlideTransition.TriggerOnClick = true; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Sample.pptx"); //Close the presentation pptxDoc.Close(); {% endhighlight %} @@ -339,7 +333,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Set the speed for transition effect -The speed is the customized property provided by the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) to set the transition duration mentioned [above](/document-processing/powerpoint/powerpoint-library/net/create-edit-slide-transitions-in-powerpoint-presentation-slides-cs-vb-net#set-the-transition-duration) (in this page) to a customized enumeration values. By default, each transition will happen for 2 seconds. You can change the following enumeration values to change the duration of a slide transition: +The `Speed` property is a predefined enumeration provided by the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) that maps to a fixed transition duration (described in the [Set the transition duration](#set-the-transition-duration) section above). By default, each transition lasts 2 seconds. You can assign any of the following enumeration values to change the duration of a slide transition: 1. Default - 2 seconds 2. [Fast](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.TransitionSpeed.html) - 0.5 seconds @@ -357,11 +351,12 @@ ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300); //Set the transition effect type slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; -//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 second +//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 seconds slide.SlideTransition.Speed = TransitionSpeed.Medium; -//Save the PowerPoint Presentation as stream -FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create); -pptxDoc.Save(outputStream); +//Save the presentation +pptxDoc.Save("Sample.pptx"); +//Close the presentation +pptxDoc.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -373,10 +368,12 @@ ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank); IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 50, 200, 300, 300); //Set the transition effect type slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard; -//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 second +//Set the transition effect speed enumeration. This will reduce the transition duration to 0.75 seconds from the default 2 seconds slide.SlideTransition.Speed = TransitionSpeed.Medium; //Save the presentation pptxDoc.Save("Sample.pptx"); +//Close the presentation +pptxDoc.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -392,15 +389,17 @@ slide.SlideTransition.TransitionEffect = TransitionEffect.Checkerboard slide.SlideTransition.Speed = TransitionSpeed.Medium 'Save the presentation pptxDoc.Save("Sample.pptx") +'Close the presentation +pptxDoc.Close() {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Slide-transitions/Set-transition-speed). -## Supported transition effect types: +## Supported transition effect types -The following are the list of transition effect options that can be applied to each transition effects. +The following table lists the transition effect options that can be applied to each transition effect. @@ -756,7 +755,7 @@ Morph @@ -1127,4 +1126,11 @@ Zoom ## Online Demo -* Explore how to create slide transition effects in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/slidetransition#/tailwind). \ No newline at end of file +* Explore how to create slide transition effects in a PowerPoint presentation using the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) in a live demo [here](https://document.syncfusion.com/demos/powerpoint/slidetransition#/tailwind). + +## Related API references + +* [`TransitionEffect`](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.TransitionEffect.html) enum +* [`TransitionEffectOption`](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.TransitionEffectOption.html) enum +* [`TransitionSpeed`](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.TransitionSpeed.html) enum +* [`ISlideTransition`](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ISlideTransition.html) interface \ No newline at end of file diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/migrate-from-net-framework-to-net-core.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/migrate-from-net-framework-to-net-core.md index 8dc3d0b3cc..c4ff191523 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/migrate-from-net-framework-to-net-core.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/migrate-from-net-framework-to-net-core.md @@ -1,12 +1,12 @@ --- -title: Migrate from .NET Framework to .NET core | Presentation | Syncfusion -description: This section illustrates migrating Syncfusion® .NET PowerPoint (Presentation) library from .NET Framework to .NET core. +title: Migrate from .NET Framework to .NET Core | Presentation | Syncfusion +description: This section illustrates migrating Syncfusion® .NET PowerPoint (Presentation) library from .NET Framework to .NET Core. platform: document-processing control: Presentation documentation: UG --- # Migrate Presentation library from .NET Framework to .NET Core -In this section, we will see about the changes which need to be considered while migrating Syncfusion® .NET PowerPoint (Presentation) library from .NET Framework to .NET Core. +In this section, we will review the changes required when migrating the Syncfusion® .NET PowerPoint (Presentation) library from .NET Framework to .NET Core. ## NuGet Packages @@ -23,26 +23,26 @@ In this section, we will see about the changes which need to be considered while
  • ByObject
  • ByWord
  • -ByChar +
  • ByChar
  • -{{'[Syncfusion.Presentation.WinForms](https://www.nuget.org/packages/Syncfusion.Presentation.WinForms/#"")'| markdownify }}
    -{{'[Syncfusion.Presentation.Wpf](https://www.nuget.org/packages/Syncfusion.Presentation.Wpf/#"")'| markdownify }}
    -{{'[Syncfusion.Presentation.AspNet](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet/#"")'| markdownify }}
    -{{'[Syncfusion.Presentation.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc5/#"")'| markdownify }}
    -{{'[Syncfusion.Presentation.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4/#"")'| markdownify }} +{{'[Syncfusion.Presentation.WinForms](https://www.nuget.org/packages/Syncfusion.Presentation.WinForms/)'| markdownify }}
    +{{'[Syncfusion.Presentation.Wpf](https://www.nuget.org/packages/Syncfusion.Presentation.Wpf/)'| markdownify }}
    +{{'[Syncfusion.Presentation.AspNet](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet/)'| markdownify }}
    +{{'[Syncfusion.Presentation.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc5/)'| markdownify }}
    +{{'[Syncfusion.Presentation.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4/)'| markdownify }}
    -{{'[Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core/#"")'| markdownify }} +{{'[Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core/)'| markdownify }}
    -{{'[Syncfusion.PresentationToPDFConverter.WinForms](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.WinForms/#"")'| markdownify }}
    -{{'[Syncfusion.PresentationToPDFConverter.Wpf](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.Wpf/#"")'| markdownify }}
    -{{'[Syncfusion.PresentationToPDFConverter.AspNet](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet/#"")'| markdownify }}
    -{{'[Syncfusion.PresentationToPDFConverter.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet.Mvc4/#"")'| markdownify }}
    -{{'[Syncfusion.PresentationToPDFConverter.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet.Mvc5/#"")'| markdownify }} +{{'[Syncfusion.PresentationToPDFConverter.WinForms](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.WinForms/)'| markdownify }}
    +{{'[Syncfusion.PresentationToPDFConverter.Wpf](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.Wpf/)'| markdownify }}
    +{{'[Syncfusion.PresentationToPDFConverter.AspNet](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet/)'| markdownify }}
    +{{'[Syncfusion.PresentationToPDFConverter.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet.Mvc4/)'| markdownify }}
    +{{'[Syncfusion.PresentationToPDFConverter.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.PresentationToPdfConverter.AspNet.Mvc5/)'| markdownify }}
    -{{'[Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core/#"")'| markdownify }} +{{'[Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core/)'| markdownify }} (required for PowerPoint-to-PDF and PowerPoint-to-Image conversion)
    @@ -73,7 +73,7 @@ Syncfusion.PresentationRenderer Syncfusion.OfficeChartToImageConverter -Not applicable - Classes are moved within Syncfusion.PresentationRenderer namespace. +Not applicable - Classes are moved within the Syncfusion.PresentationRenderer namespace. @@ -93,7 +93,7 @@ Not applicable - Classes are moved within Syncfusion.PresentationRenderer namesp -{{'[ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html#"")'| markdownify }} +{{'[ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html)'| markdownify }} Not applicable - It is handled internally. @@ -116,7 +116,7 @@ Not applicable - It is handled internally. -{{'[IPresentation.ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentation.html#Syncfusion_Presentation_IPresentation_ChartToImageConverter"")'| markdownify }} +{{'[IPresentation.ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentation.html#Syncfusion_Presentation_IPresentation_ChartToImageConverter)'| markdownify }} Not applicable - It is handled internally. @@ -124,26 +124,26 @@ Not applicable - It is handled internally. -{{'[PresentationToPdfConverterSettings.EnablePortableRendering](https://help.syncfusion.com/cr/document-processing/Syncfusion.PresentationToPdfConverter.PresentationToPdfConverterSettings.html#Syncfusion_PresentationToPdfConverter_PresentationToPdfConverterSettings_EnablePortableRendering"")'| markdownify }} +{{'[PresentationToPdfConverterSettings.EnablePortableRendering](https://help.syncfusion.com/cr/document-processing/Syncfusion.PresentationToPdfConverter.PresentationToPdfConverterSettings.html#Syncfusion_PresentationToPdfConverter_PresentationToPdfConverterSettings_EnablePortableRendering)'| markdownify }} -This is the default approach in .NET Core and handled internally. +No code change required. Equivalent portable rendering is now the default behavior in .NET Core and is handled internally. -{{'[PresentationToPdfConverterSettings.RecreateNestedMetafile](https://help.syncfusion.com/cr/document-processing/Syncfusion.PresentationToPdfConverter.PresentationToPdfConverterSettings.html#Syncfusion_PresentationToPdfConverter_PresentationToPdfConverterSettings_RecreateNestedMetafile"")'| markdownify }} +{{'[PresentationToPdfConverterSettings.RecreateNestedMetafile](https://help.syncfusion.com/cr/document-processing/Syncfusion.PresentationToPdfConverter.PresentationToPdfConverterSettings.html#Syncfusion_PresentationToPdfConverter_PresentationToPdfConverterSettings_RecreateNestedMetafile)'| markdownify }} -Not supported due to .NET Core limitations. +Not supported due to .NET Core limitations. Nested metafile recreation has no workaround in .NET Core; flatten metafiles before conversion if required. -{{'[ITextBody.FitTextOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ITextBody.html#Syncfusion_Presentation_ITextBody_FitTextOption"")'| markdownify }} +{{'[ITextBody.FitTextOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.ITextBody.html#Syncfusion_Presentation_ITextBody_FitTextOption)'| markdownify }} -Not supported +Not supported in the current .NET Core release. @@ -163,23 +163,23 @@ Not supported -{{'[Presentation.Open(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Open_System_String_"")'| markdownify }} +{{'[Presentation.Open(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Open_System_String_)'| markdownify }} -You can open the document as stream from the file system using {{'[Presentation.Open(Stream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Open_System_IO_Stream"")'| markdownify }} API. +The path-based overload remains available. Alternatively, open a file as a stream using {{'[Presentation.Open(Stream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Open_System_IO_Stream)'| markdownify }}. -{{'[Presentation.Save(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Save_System_String_"")'| markdownify }} +{{'[Presentation.Save(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Save_System_String_)'| markdownify }} -You can save the document as stream to the file system using {{'[Presentation.Save(Stream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Save_System_IO_Stream_"")'| markdownify }} API. +The path-based overload remains available. Alternatively, save to a stream using {{'[Presentation.Save(Stream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.Presentation.html#Syncfusion_Presentation_Presentation_Save_System_IO_Stream_)'| markdownify }}. -{{'[Presentation.Save(string fileName, FormatType formatType, HttpResponse response)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentation.html#Syncfusion_Presentation_IPresentation_Save_System_String_Syncfusion_Presentation_FormatType_System_Web_HttpResponse_"")'| markdownify }} +{{'[Presentation.Save(string fileName, FormatType formatType, HttpResponse response)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentation.html#Syncfusion_Presentation_IPresentation_Save_System_String_Syncfusion_Presentation_FormatType_System_Web_HttpResponse_)'| markdownify }} You can save the document as stream and then download from browser. @@ -187,29 +187,38 @@ You can save the document as stream and then download from browser. -{{'[IPresentationChart.SaveAsImage(Stream imageAsStream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentationChart.html#Syncfusion_Presentation_IPresentationChart_SaveAsImage_System_IO_Stream_"")'| markdownify }} +{{'[IPresentationChart.SaveAsImage(Stream imageAsStream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.IPresentationChart.html#Syncfusion_Presentation_IPresentationChart_SaveAsImage_System_IO_Stream_)'| markdownify }} -IPresentationRenderer.ConvertToImage(IPresentationChart chart, Stream outputStream) +{{'[IPresentationRenderer.ConvertToImage(IPresentationChart chart, Stream outputStream)](https://help.syncfusion.com/cr/document-processing/Syncfusion.PresentationRenderer.IPresentationRenderer.html)'| markdownify }} ## Advantages -Supports Windows, macOS, Linux, docker, Azure, and AWS environments. +- Cross-platform support: Windows, macOS, Linux, Docker, Azure, and AWS environments. +- Full feature parity with the .NET Framework library for core PowerPoint creation, editing, and conversion scenarios. +- A single package (`Syncfusion.Presentation.Net.Core`) replaces the multiple platform-specific packages required on .NET Framework. ## Known limitations -EMF and WMF images are not supported in .NET Core platform. +- **EMF and WMF images are not supported in .NET Core.** Replace any embedded EMF/WMF images with PNG or JPEG before conversion. +- For a full list of platform-level limitations (chart types, OLE objects, and so on), see the [Syncfusion PowerPoint library limitations](https://help.syncfusion.com/document-processing/powerpoint/overview#limitations) page. ## Notable changes -* Graphics library: In .NET Framework, our library makes use of System.Drawing.Common for any text measuring and graphics-related operations. Whereas in .NET Core, our library uses the SkiaSharp graphics library to provide the same type of graphics. -* The below features are make use of SkiaSharp graphics library, which are separated into a separate package, [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core) - * [PowerPoint Presentation to PDF](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf) - * [PowerPoint Presentation to Image](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image) -* During PowerPoint Presentation to PDF/Image conversion, if you are facing font-related problems (like accessing font from the environment), you can pass the fonts as streams using our [font substitution approach](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf#font-substitution-for-unavailable-fonts). +- **Graphics library:** In .NET Framework, the library uses `System.Drawing.Common` for text measuring and graphics operations. In .NET Core, the library uses the [SkiaSharp](https://learn.microsoft.com/dotnet/maui/graphics/skia) graphics library to provide the same behavior. When deploying to Linux, ensure the SkiaSharp native assets for the target runtime are available; see the [SkiaSharp platform notes](https://learn.microsoft.com/dotnet/maui/graphics/skia#platform-specific-notes). +- **Separate renderer package:** The following conversion features rely on SkiaSharp and are delivered through a separate package, [Syncfusion.PresentationRenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.PresentationRenderer.Net.Core): + - [PowerPoint Presentation to PDF](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf) + - [PowerPoint Presentation to Image](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-image/net/presentation-to-image) +- **Font handling:** During PowerPoint-to-PDF or PowerPoint-to-Image conversion, if you encounter font-related issues (such as missing fonts in the environment), pass the fonts as streams using the [font substitution approach](https://help.syncfusion.com/document-processing/powerpoint/conversions/powerpoint-to-pdf/net/presentation-to-pdf#font-substitution-for-unavailable-fonts). -N> If you want to migrate without any code changes from [Syncfusion.Presentation.ASP.NET](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4) NuGet in application targeting .NET Framework, you can consider to use anyone of the packages +N> If you want to migrate without any code changes from the [Syncfusion.Presentation.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4) NuGet in an application targeting .NET Framework, you can use any of the following packages: N> * [Syncfusion.Presentation.WinForms](https://www.nuget.org/packages/Syncfusion.Presentation.WinForms) N> * [Syncfusion.Presentation.Wpf](https://www.nuget.org/packages/Syncfusion.Presentation.Wpf) -N> * [Syncfusion.Presentation.AspNet.Mcv4](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4) -N>*But, this is not a recommended approach.* +N> * [Syncfusion.Presentation.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.Presentation.AspNet.Mvc4) +N> +N> *This approach is not recommended for new development.* + +## See also +- [NuGet Packages Required](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/nuget-packages-required) +- [Getting Started with Presentation library](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/getting-started) +- [Create PowerPoint in ASP.NET Core](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/create-read-edit-powerpoint-files-in-asp-net-core-c-sharp) diff --git a/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/multithreading-in-powerpoint-library-faqs.md b/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/multithreading-in-powerpoint-library-faqs.md index 85b1dd9cac..c78c55ac88 100644 --- a/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/multithreading-in-powerpoint-library-faqs.md +++ b/Document-Processing/PowerPoint/PowerPoint-Library/NET/faqs/multithreading-in-powerpoint-library-faqs.md @@ -1,22 +1,22 @@ --- -title: FAQ about multithreading in PowerPoint presentation | Syncfusion +title: FAQ about multithreading with the PowerPoint library | Syncfusion description: Learn about the FAQs on multithreading support for opening, editing, and saving PowerPoint presentations using the .NET PowerPoint (Presentation) library. platform: document-processing control: PowerPoint documentation: UG --- -# Frequently asked questions about multithreading in PowerPoint +# Frequently asked questions about multithreading in the PowerPoint library -The frequently asked questions regarding multithreading and thread-safety support in opening, editing, and saving PowerPoint presentations are listed below. +The frequently asked questions regarding multithreading and thread-safety support in opening, editing, and saving PowerPoint presentations using the Syncfusion [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) are listed below. ## Does the PowerPoint library support multithreading and thread-safety? -Yes, the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) is thread-safe, allowing you to create multiple instances of the [Presentation](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.html) class to load the same file as multiple copies or different PowerPoint files and save them using multithreading in C#. +Yes, the [.NET PowerPoint Library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) is thread-safe. You can create multiple instances of the [Presentation](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.html) class on different threads to load the same or different PowerPoint files and save them concurrently using multithreading in C# and VB.NET. Thread-safety applies per instance — each `Presentation` instance should be used by a single thread; do not share one instance across threads. -### Multithreading PowerPoint reading using tasks +### Multithreading PowerPoint open-edit-save using tasks -The following code example illustrates how to use multithreading to open, edit, and save multiple copies of a PowerPoint presentation by creating multiple tasks in C#. +The following code example illustrates how to use multithreading to open, edit, and save multiple copies of a PowerPoint presentation by creating multiple tasks in C# and VB.NET. {% tabs %} @@ -132,9 +132,9 @@ End Module You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Read-and-save-PowerPoint-presentation/Multithreading-using-tasks). -### Multithreading PowerPoint reading using parallel process +### Multithreading PowerPoint open-edit-save using a parallel for loop -The following code example illustrates how to use a parallel for loop to process multiple tasks concurrently, opening, editing, and saving PowerPoint presentations using multithreading in C#. +The following code example illustrates how to use a parallel for loop to process multiple iterations concurrently, opening, editing, and saving PowerPoint presentations using multithreading in C# and VB.NET. {% tabs %} @@ -248,4 +248,10 @@ End Module {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Read-and-save-PowerPoint-presentation/Multithreading-using-parallel-process). \ No newline at end of file +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PowerPoint-Examples/tree/master/Read-and-save-PowerPoint-presentation/Multithreading-using-parallel-process). + +## See also + +- [Loading and saving the presentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/loading-and-saving-the-presentation) +- [Open and save a PowerPoint presentation in a console application](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/open-and-save-powerpoint-in-console-application) +- [Syncfusion Presentation API reference](https://help.syncfusion.com/cr/document-processing/Syncfusion.Presentation.html) \ No newline at end of file