Main Content

Customize aMicrosoftWord标题页Template

The Report Explorer default Word document conversion template contains document part templates for the front (recto) and back (verso) side of a report title page. The Report Explorer file converter for theWord (from template)output type uses the title page part templates to produce the title pages in the Word output.

This example shows how to create a custom template that changes the color of the title and how to customize the layout of a title page. The example uses a custom template with the Report Generator magic square report example.

Create a Custom Template

Note

To complete the rest of this example, you need a custom Word conversion template. If you have a custom template that you want to use for this example, you can skip toChange the Color of a Report Title.

  1. In the Report Explorer, selectTools>Edit Document Conversion Template.

  2. In the list of templates, select theDefault Word Template.

  3. In the Template Browser, clickCopy template.

  4. In the file browser, navigate to the folder on the MATLAB®path that you want to use for the custom template. For the file name, entermagic-squareand clickSave.

  5. In the list of templates, selectCopy of Default Word Template.

  6. 顶部的模板属性对话框中,use these settings:

  7. Apply the properties by selecting another template in the list of templates.

Change the Color of a Report Title

You can customize theMagic Square Template(seeCreate a Custom Template) to use blue text for the report title.

  1. In the Report Explorer, selectTools>Edit Document Conversion Template.

  2. In the Report Explorer list of Word templates, selectMagic Square Template.

  3. In the Template Browser, clickOpen style sheet. In Word, the template opens, with the Manage Styles dialog box displayed.

  4. In the Manage Styles dialog box, select thergTitlestyle and clickModify.

  5. In the Modify Style dialog box forrgTitle, click the down arrow forAutomatic. Select the blue color box and clickOK.

  6. In the Manage Styles dialog box, clickOK.

  7. Save and close the template.

分配一份报告模板

You can assign the customized template to themagic-square.rptReport Explorer report.

  1. In the Report Explorer, selectReport Generatornode.

  2. In the Report Explorer, in the list of reports, selectmagic_square.rpt.

  3. In the Report Options pane, clickOpen report.

  4. In themagic_squaresreport, add a标题页component. In the Title Page dialog box, set theTitlefield toMagic Squares.

  5. Below the标题页component, add aChaptercomponent.

  6. In the Report Options dialog box, setFile formattoWord (from template)and instead ofDefault Word Template, selectMagic Squares Template.

  7. Generate the report. Select themagic_squaresreport. In the Report Explorer toolbar, click theReportbutton.

    In the generated report, the title,Magic Squares, appears in blue.

Customize Title Page Content and Layout

This example assumes you have created a custom Magic Square Template (seeCreate a Custom Template). You can use a different custom Word template.

  1. In the Report Explorer, selectTools>Edit Document Conversion Template.

  2. In the Report Explorer list of Word templates, selectMagic Square Template. In the Report Options pane, clickOpen template.

  3. With the cursor in the first (and only visible) paragraph in the template, in theInserttab, select theQuick Partsbutton.

  4. In the Quick Parts gallery, selectrgRectoTitlePageto insert of the front title page part template in the main document conversion template.

    Tip

    To display Word markup for the part template, on the Word ribbon, in theDevelopertab, clickDesign Mode.

  5. Highlight thergImagehole and drag it above thergTitlehole.

  6. 删除thergAuthorhole.

  7. Select thergRectoTitlePagepart template and click theQuick Partsbutton.

  8. ClickSave Selection to Quick Part Gallery.

  9. In the Create New Building Block dialog box, setNametorgRectoTitlePageand theCategorytomlreportgen. ClickOK.

  10. In the template, select the contents of the part template (including the section break) and click the删除button.

  11. Save and close the template.

Suppose that you use the custom template to generate a report that has a标题页component that specifies an image and an author. The generated report displays the image at the top of the title page and does not include an author.

Related Examples

More About