Main Content

Customize a Microsoft Word Title Page 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 the Word (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 to Change the Color of a Report Title.

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

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

  3. In the Template Browser, click Copy 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, enter magic-square and click Save.

  5. In the list of templates, select Copy of Default Word Template.

  6. At the top of the Template Properties dialog box, 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 the Magic Square Template (see Create a Custom Template) to use blue text for the report title.

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

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

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

  4. In the Manage Styles dialog box, select the rgTitle style and click Modify.

  5. In the Modify Style dialog box for rgTitle, click the down arrow for Automatic. Select the blue color box and click OK.

  6. In the Manage Styles dialog box, click OK.

  7. Save and close the template.

Assign the Template to a Report

You can assign the customized template to the magic-square.rpt Report Explorer report.

  1. In the Report Explorer, select Report Generator node.

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

  3. In the Report Options pane, click Open report.

  4. In the magic_squares report, add a Title Page component. In the Title Page dialog box, set the Title field to Magic Squares.

  5. Below the Title Page component, add a Chapter component.

  6. In the Report Options dialog box, set File format to Word (from template) and instead of Default Word Template, select Magic Squares Template.

  7. Generate the report. Select the magic_squares report. In the Report Explorer toolbar, click the Report button.

    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 (see Create a Custom Template). You can use a different custom Word template.

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

  2. In the Report Explorer list of Word templates, select Magic Square Template. In the Report Options pane, click Open template.

  3. With the cursor in the first (and only visible) paragraph in the template, in the Insert tab, select the Quick Parts button.

  4. In the Quick Parts gallery, select rgRectoTitlePage to 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 the Developer tab, click Design Mode.

  5. Highlight the rgImage hole and drag it above the rgTitle hole.

  6. Delete the rgAuthor hole.

  7. Select the rgRectoTitlePage part template and click the Quick Parts button.

  8. Click Save Selection to Quick Part Gallery.

  9. In the Create New Building Block dialog box, set Name to rgRectoTitlePage and the Category to mlreportgen. Click OK.

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

  11. Save and close the template.

Suppose that you use the custom template to generate a report that has a Title Page 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