Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Form-Based Reports

You can use the Report Explorer to create a report based on a form or a set of forms. A form is a document used to generate other documents of a predetermined type. The form includes the fixed content of the document type and markers to designate the location of the variable content. For example, a tax form contains blanks to indicate the location of variable content.

The Report Explorer provides a set of components that allow you to generate reports from forms represented by Word, HTML, or PDF templates. You can use Word to create forms for Word reports and an HTML or text editor to create forms for HTML and PDF documents. You can use standard features of Word and HTML documents to designate the location of generated content, called holes, in a form.

Workflow for Creating Form-Based Reports

To create a form-based report, follow this process. For an example that uses this workflow, see Create a Simple Form-Based Setup.

Create a Template

Create a template to use with Report Explorer.

  1. In the Report Explorer, create a copy of one of the Report Explorer default templates or a template based on one of the default templates. See Copy a Template.

  2. To specify the form’s fixed content and holes, edit the templates. See:

Create a Form-Based Setup

  1. To create a Report Form component, in the Report Explorer, select File > New Form.

  2. Use the Report Form component dialog box to specify the output format and report form template.

    Specifying the report template populates the Report Form component with Template Hole and layout components representing the holes and page layouts defined in the template.

  3. Use the Report Explorer to append Paragraph, Image, Table, control flow, and other types of components to the Template Hole components. At report generation time, the content generated by these components fills the holes in the fixed content specified by the report form template.

  4. Save the report setup.

Generate the Report

Executing the Report Form component copies the fixed content specified by its template to the output report. This process fills the holes in the fixed content with content generated dynamically by the children of the Report Form component hole components.

  1. Select the Report Form component in the Report Explorer.

  2. To execute the report form, select File > Report.

Create Multiform-Based Report Setups

You can create multiform-based report setups, for example, a report setup that uses separate form templates for the title page, table-of-contents (TOC) section, and chapter sections.

  1. Create a main template that contains one or more holes to fill with generated content, including content based on other forms, called subforms.

  2. Create a template for each of the subforms to include in the report. The subforms can contain holes to fill with content, including subforms. Use the same document type for subform templates as you do for the main template.

  3. Create the report setup’s main Report Form component.

  4. Assign the main template to the main Report Form component. Assigning the template populates the main Report Form component with Template Hole component representing the report’s top-level holes.

  5. Populate the main form’s Template Hole components with components that generate the content for the hole. You can use Subform components to fill a hole with content based on subform templates, for example, a title page based on a title page template.

Fill a Hole with a Subform

You can fill holes in a form-based report with content based on templates called subforms. For example, you can create a title page by filling a hole in the report’s main form with a title page subform. If the subform contains holes, you can fill the holes with subforms to generate a report based on a hierarchy of forms.

You can add a Subform component to a Template Hole component as its child or to a component that is a descendant of the parent Template Hole component. For example, if you want to include a subform conditionally or repetitively to a hole, append a control flow component (such as If, For, or While) to the parent Template Hole component. Then append the Subform component to the control flow component.

  1. Add a Subform component as a child or descendant of the Template Hole component representing the hole in the parent form.

  2. Assign the template that defines the subform to the Subform component.

    Assigning the subform template to the Subform component populates the Subform component with Template Hole components that represent the holes defined by the subform template.

  3. Append components to the subform’s hole components that generate the content of the holes defined by the subform template. You can also use subforms, that is, Subform components, to fill the holes in a subform.

Define Page Layouts in a Form-Based Report Setup

To define the page layouts of the report generated by the setup, use page layout components in your form-based report setup. The Report Generator provides two page layout components:

  • A PDF Page Layout component for PDF reports

  • A DOCX Page Layout component for Word reports

Use the appropriate component for your report. If your report has only one page layout, use a single page layout component to define the layout. If your report has multiple sections with differing layouts, use multiple page layout components.

Generated Page Layout Components from a Template

You can add page layout components to your setup by first defining the page layouts in the templates associated with the Report Form component and the Subform components in your setup. When you assign a template to a Report Form or Subform component in your setup, using the component dialog box, the Report Generator creates a Template Hole component, called a section hole, for each page layout defined in the template. It appends the hole to the associated Form or Subform component as its first (or only) hole. Each section hole contains a page layout component that specifies the corresponding layout for that section defined in the template.

You can override the layout defined in the template by changing the values in the layout component dialog box. You can also add content to the section by using the Report Explorer to append Paragraph and other content components to the section hole component.

If the template defines page headers and footers for the page layout, the Report Generator generates corresponding page header and footer components and appends them to the page layout component. If the template does not define page headers or footers for a page layout, you can use the Report Explorer to append page header and footer components to the page layout component. You can add content to any header and footer by appending content components, for example, Paragraph components, using the Report Explorer.

Add Page Layouts Interactively to a Report Setup

You do not have to define page layouts in templates. You can define them in your report setup by using the Report Explorer. In this case, append page layout components with the appropriate settings to hole components in your setup. Use this capability if you to create page layouts dynamically at report generation time. For example, you can adjust page margins to fit images whose size you do not know before you generate the report.

See Also

| | | | | |

Related Topics

Was this topic helpful?