Main Content

Set Up aPowerPoint介绍Template

PowerPoint®模板指定固定内容和默认布局以及演示文稿中幻灯片的外观。当您使用PPT API创建演示文稿时,您可以指定要使用的模板。模板可以为空或具有幻灯片。模板中的任何内容都出现在新演示文稿中。如果未指定模板,则PPT API使用默认模板。

The template that you specify can be:

  • PPT API默认模板的自定义副本。

  • 现有的演示文稿。

  • 您在PowerPoint中设置的模板。

要自定义要用作模板的默认模板或现有演示文稿的副本,您可以使用PPT API或PowerPoint。要添加或自定义幻灯片布局,请使用PowerPoint。

指定模板

要指定模板,请在创建一个时提供模板名称作为第二个参数mlreportgen.ppt.Presentationobject. For example, this code specifies the templatemyTemplate.pptx

进口mlreportgen.ppt.*ppt = Presentation("myPresentation.pptx",,,,“ mytemplate.pptx”);

To use the PPT API default template, omit the second argument. For example:

进口mlreportgen.ppt.*ppt = Presentation("myPresentation.pptx");

Copy the Default Template

To copy the PPT API default template, usemlreportgen.ppt.presentation.createTemplate。For example:

templatePath = mlreportgen.ppt.Presentation.createTemplate(“ mytemplate.pptx”);

使用PPT API自定义模板

自定义默认PPT API模板的副本或要用作模板的现有演示文稿:

  1. 创建一个介绍object and specify the template for both the presentation argument and the template argument.

  2. Update the template so that it contains the slides and content that you want in the template. For example, add a slide.

  3. 要保存模板,请关闭介绍object.

例如,此代码创建默认模板的副本,在模板中添加标题幻灯片,替换幻灯片标题,并指定标题为红色:

mlreportgen.ppt.presentation.createTemplate(templateName); importmlreportgen.ppt.*TemplateName =“ mytemplate.pptx”;PPT1 =表示(TemplateName,TemplateName);打开(ppt1);幻灯片= add(ppt1,“标题幻灯片”); title = Paragraph(“我的标题”); title.Style = [title.Style {FontColor(“红色的”)}]; replace(slide,“标题”,标题);close(ppt1); rptview(ppt1);

When you create a presentation usingmyTemplate.pptxas the template, the presentation has a title slide with the title我的标题in red.

要自定义要使用模板的现有演示文稿,请使用与使用相同的过程来自定义默认模板的副本。例如,此代码创建了一个称为的演示文稿mypresentation.pptxthat has one slide and then customizesmypresentation.pptxby replacing the slide title and making the title text red.

进口mlreportgen.ppt.*主名="myPresentation.pptx";ppt2 =表示(预名);打开(PPT2);幻灯片= add(ppt2,“标题幻灯片”); close(ppt2); ppt3 = Presentation(presName,presName); open(ppt3); slide = ppt3.Children(1); title = Paragraph(“我的标题”); title.Style = [title.Style {FontColor(“红色的”)}]; replace(slide,“标题”,标题);关闭(PPT3);rptview(ppt3);

When you create a presentation usingmypresentation.pptx作为模板,演示文稿的标题幻灯片带有标题我的标题in red.

Customize a Template Interactively inPowerPoint

Use PowerPoint for these template customizations:

Specify the Default Formatting of a Presentation

To specify formatting to apply throughout a presentation, use a slide master. The formatting in a slide master is the default formatting for all its child slide layouts.

  1. 在PowerPoint中,打开要用作模板的模板或演示文稿。

  2. 在里面Viewtab, in theMaster Views部分,单击幻灯片主。例如,使用默认的PPT API模板:

    PowerPoint Slide Master view

  3. In a slide master, click in a placeholder. For example, in the master title slide, click inClick to edit Master title styletext and select a formatting option, such as changing the font color to red.

  4. Save the template.

添加幻灯片大师

You can add a slide master to a PowerPoint template. Adding a slide master is useful for providing different formatting for different parts of a presentation.

  1. Open the template in PowerPoint.

  2. 在里面Viewtab, in theMaster Views部分,单击幻灯片主

  3. 在里面slide master and layout pane, click after the last slide layout.

  4. Right-click and selectInsert Slide Master。出现了一个新的幻灯片大师,并在其下面带有幻灯片布局的副本。

    Slide master and layout pane with new master slide

  5. Format the new slide master.

  6. 给幻灯片大师一个有意义的名字。默认情况下,PowerPoint名称新大师Custom Design,,,,1_custom设计,,,,2_Custom Design, 等等。在里面幻灯片主tab, in theEdit Master部分,单击Renameand follow the prompts.

  7. Save the template.

Format a Slide Layout

要指定格式以应用于特定类型的幻灯片,请使用幻灯片布局。

  1. Open the template in PowerPoint.

  2. 在里面Viewtab, in theMaster Views部分,单击幻灯片主

  3. 从幻灯片大师和布局窗格中,选择要更改其格式的幻灯片布局。例如,在PPT API默认模板中,单击标题和内容幻灯片布局。

    小费

    要查看幻灯片布局的名称,请指向布局。出现了带有幻灯片布局名称和使用布局的幻灯片的工具提示。

    选中标题和内容幻灯片布局的幻灯片主视图

  4. In a slide master, click in a placeholder whose formatting you want to change. For example, in the default PPT API template, in the Title and Content slide layout, click inClick to edit Master title style。选择格式选项,例如将字体颜色更改为红色。更改适用于该幻灯片布局的标题,但不适用于其他幻灯片布局的标题。

    Placeholder title in the Title and Content slide layout is red.

  5. Save the template.

添加幻灯片布局

You can add a slide layout to a PowerPoint template.

  1. Open the template in PowerPoint.

  2. 在里面Viewtab, in theMaster Views部分,单击幻灯片主

  3. In a slide layout, right-click and selectInsert Layout。A new slide layout appears, with a title placeholder.

    小费

    要创建基于现有幻灯片布局的幻灯片布局,请右键单击要基于布局的幻灯片布局。然后选择Duplicate Layout

  4. Customize the layout. For example, you can change the font for an existing placeholder or add a placeholder, such as a table placeholder. You can interactively set the location and size of the table placeholder. To remove or add title and footers, use theTitleand页脚check boxes in the幻灯片主tab.

    幻灯片主view with Insert Placeholder > Table selected

  5. 给幻灯片布局一个有意义的名称。(默认情况下,PowerPoint名称新布局Custom Layout,,,,1_custom布局,,,,2_custom布局,等等。)幻灯片主tab, in theEdit Master部分,单击Renameand follow the prompts.

  6. Save the template.

在幻灯片布局中添加占位符

您可以将任何类型的占位符添加到任何幻灯片布局中。但是,使用PPT API,您可以替换此占位符的子集:

  • Content

  • Text

  • 图片

  • Table

  1. Open the template in PowerPoint.

  2. 在里面Viewtab, in theMaster Views部分,单击幻灯片主

  3. 在幻灯片布局窗格中,选择WAN的幻灯片布局以添加占位符。

  4. 在里面幻灯片主tab, in theMaster Layout部分,单击插入占位符并从列表中选择占位符的类型。例如,在默认的PPT API模板中,将表占位符添加到空白幻灯片布局中。

    幻灯片主view with Insert Placeholder > Table selected

  5. 在幻灯片布局中,尺寸并定位占位符。

  6. Name the placeholders that you want to use when you add or replace content with the PPT API. To name a placeholder, first display the选择pane. On theHometab, in theEditing部分,选择选择>选择窗格。在里面选择窗格,单击占位符名称,然后键入新的名称。

  7. 在里面幻灯片主tab, in the部分,单击关闭主视图

  8. Save the template.

Related Topics