Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
[PowerPointTemplate] provides an intuitive high-performance way to import database values to a presentation, but cannot otherwise modify a presentation at runtime. The [PowerPointApplication] object model allows you to modify additional aspects of the presentation at runtime. 
{excerpt}You can take advantage of the features of both PowerPointApplication and PowerPointTemplate by using them together. For example, you can use PowerPointTemplate to open and populate a PowerPointWriter template, then pass the populated presentation to PowerPointApplication to modify document properties. {excerpt}

h2. PowerPointTemplate to PowerPointApplication

To pass a presentation from PowerPointTemplate to PowerPointApplication, do not call [PowerPointTemplate.Save|PowerPointTemplate.Save]. Instead, pass the PowerPointTemplate object to PowerPointApplication's [Open|PowerPointApplication.Open] method:
{csharp}
PowerPointTemplate pptt = new PowerPointTemplate();
pptt.Open(templatePath);
pptt.BindData(valuesArray, colNamesArray,"DataSourceName", pptt.CreateDataBindingProperties());
pptt.Process();

//--- Create an instance of PowerPointApplication and
//--- open the presentation you created with PowerPointTemplate.
//--- The presentation will be returned as a Presentation
//--- object.
PowerPointApplication ppta = new PowerPointApplication();
Presentation pres = ppta.Open(pptt);
{csharp}
{vbnet}

Dim pptt As PowerPointTemplate = new PowerPointTemplate();
pptt.Open(templatePath);
pptt.BindData(valuesArray, colNamesArray,"DataSourceName", pptt.CreateDataBindingProperties());
pptt.Process();

//--- Create an instance of PowerPointApplication and
//--- open the presentation you created with PowerPointTemplate.
//--- The presentation will be returned as a Presentation
//--- object.
Dim ppta As PowerPointApplication = new PowerPointApplication();
Dim pres As Presentation = ppta.Open(pptt);
{vbnet}

h2. PowerPointApplication to PowerPointTemplate

To pass a presentation from PowerPointApplication to PowerPointTemplate, do not call [PowerPointApplication.Save]. Instead, pass the [PowerPointApplication] object, along with the [Presentation] object that you want to populate, to PowerPointTemplates's [Open|PowerPointTemplate.Open] method:
{csharp}
PowerPointApplication ppta = new PowerPointApplication();
Presentation present = ppta.Open("StartingFile.pptx");

//--- Code modifying and customizing the presentation here

PowerPointTemplate ppt = new PowerPointTemplate();
ppt.Open(ppta, present);

{csharp}
{vbnet}

Dim ppta As PowerPointApplication = new PowerPointApplication();
Dim present As Presentation = ppta.Open("StartingFile.pptx");

//--- Code modifying and customizing the presentation here

Dim ppt As PowerPointTemplate = new PowerPointTemplate();
ppt.Open(ppta, present);

{vbnet}