Add Holes in a Microsoft Word Template

Holes are placeholders that are filled with content as you generate a report. The MATLAB® Report Generator™ API replaces any content in a hole in the template with generated content. The API uses Word's rich text content control to create the holes.

Inline and Block Holes

Document bodies and tables support inline and block holes. The way in which you insert inline and block holes in the body of a document differs from the way you do for tables.

Open Word Template and Display Developer Ribbon

To open a Word template, right-click the .dotx file and click Open from the menu. (If you click the .dotx file, a new .doc file that uses that .dotx file as its template opens.)

Before you can add a hole to a Word template, you must open the template and display the Developer ribbon.

To work with holes in a Word template, use the Word Developer ribbon. If the Developer ribbon does not appear, add it.

  1. In Word, select File > Options.

  2. In the Word Options dialog box, select Customize Ribbon.

  3. In the Customize the Ribbon list, select the Developer check box and click OK.

    Tip

    If you do not see Developer check box in the list, set Customize the Ribbon to Main Tabs.

Create an Inline Hole in a Paragraph

An inline hole is a hole within a document body paragraph. It can contain any elements that a paragraph element can contain.

  1. On the Developer ribbon, click Design Mode. (See Open Word Template and Display Developer Ribbon.) This mode enables you to see the hole marks with the title tag after you create the hole.

  2. Click in the paragraph where you want to create an inline hole.

    If the hole is the only hole in a paragraph or is at the end of a paragraph:

    1. Add several blank spaces at the end of the paragraph to ensure that an inline hole, not a block hole, is created.

    2. Insert the hole before the spaces.

    3. Delete the extra spaces.

  3. Click the Rich Text Content Control button . A rich text content control appears at the insertion point.

  4. Click the hole and then, click the Properties button.

  5. In the Content Control Properties dialog box, enter

    • In the Title field, enter an ID for the hole.

    • In the Tag field, enter Hole.

    • Set the default character style for the hole. Select the Use a style to format text typed into the empty control and select a Style from the dropdown or click New Style to create a style.

  6. Click OK.

Create a Block Hole in the Document Body

A block hole is a hole that can contain paragraphs or any other type of content. Block holes must be at the top level of a document.

  1. On the Developer ribbon, click Design Mode. (See Open Word Template and Display Developer Ribbon.)

  2. Create an empty paragraph where you want to create a block hole. Creating a paragraph ensures that a block hole and not an inline hole is created. If you are at the end of a document, create a second empty paragraph.

  3. Select the empty paragraph. (If you have created two paragraphs, select the first one.)

  4. Click the Rich Text Content Control button . A rich text content control appears and includes the paragraph inside its boundary.

  5. If you created two paragraphs, delete the second paragraph.

  6. Click the hole and then, click the Properties button.

  7. In the Content Control Properties dialog box:

    • In the Title field, enter an ID for the hole.

    • In the Tag field, enter Hole.

    • Set the default style for the hole. Select the Use a style to format text typed into the empty control and select a Style from the drop-down or click New Style to create a style.

  8. Click OK.

Create an Inline Hole in a Table Entry

An inline hole is a hole within a paragraph. It can contain any elements that a paragraph element can contain. Every Word table entry is a paragraph, although its paragraph mark is not visible.

  1. On the Developer ribbon, click Design Mode. (See Open Word Template and Display Developer Ribbon.) This mode enables you to see the hole marks with the title tag after you create the hole.

  2. To add an inline hole, add a few spaces to an empty table entry where you want to create the hole. You add spaces before adding the hole to ensure that the hole is an inline hole and that the table entry mark is outside the hole.

  3. Position the cursor after the spaces.

  4. Click the Rich Text Content Control button . A rich text content control appears at the insertion point, and for an inline hole, the table entry mark is outside the hole boundary.

  5. Delete the spaces to ensure that unwanted spaces do not display in the output document.

  6. Click the hole and then, click the Properties button.

  7. In the Content Control Properties dialog box:

    • In the Title field, enter an ID for the hole.

    • In the Tag field, enter Hole.

    • Set the default character style for the hole. Select the Use a style to format text typed into the empty control and select a Style from the dropdown or click New Style to create a style.

Create a Block Hole in a Table Entry

A block hole is a hole that can contain paragraphs or any other type of content. Block holes must be at the top level of a table entry. Block holes in a table do not support DocumentPart elements.

  1. On the Developer ribbon, click Design Mode. (See Open Word Template and Display Developer Ribbon.) This mode enables you to see the hole marks with the title tag after you create the hole.

  2. To add a block hole, position the cursor in an empty table entry. Adding the hole to an empty entry ensures that the block hole is at the top level of the table entry.

  3. Click the Rich Text Content Control button . A rich text content control appears at the insertion point, and for a block hole, the table entry mark is inside the hole boundary.

  4. Click the hole and then, click the Properties button.

  5. In the Content Control Properties dialog box:

    • In the Title field, enter an ID for the hole.

    • In the Tag field, enter Hole.

    • Set the default style for the hole. Select the Use a style to format text typed into the empty control and select a Style from the dropdown or click New Style to create a style.

  6. Click OK.

Related Topics