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
This is the workflow you use to create a form-based report. 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.
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.
To specify the form’s fixed content and holes, edit the templates. See:
Create a Form-Based Setup
To create a Report Form component, in the Report Explorer, select File > New Form.
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.Use the Report Explorer to append
Paragraph
,Image
,Table
, control flow, and other types of components to theTemplate 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.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.
Select the Report Form component in the Report Explorer.
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.
Create a main template that contains one or more holes to fill with generated content, including content based on other forms, called subforms.
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.
Create the report setup’s main Report Form component.
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.Populate the main form’s
Template Hole
components with components that generate the content for the hole. You can useSubform
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.
Add a
Subform
component as a child or descendant of theTemplate Hole
component representing the hole in the parent form.Assign the template that defines the subform to the
Subform
component.Assigning the subform template to the
Subform
component populates theSubform
component withTemplate Hole
components that represent the holes defined by the subform template.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 reportsA
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
DOCX Page Layout
| PDF Page Layout
| Page Footer
| Page Header
| Subform
| Template Hole
| mlreportgen.dom.Document.createTemplate
Related Topics
- Create a Simple Form-Based Setup
- Open a Template
- Create Page Layout Sections
- Generate a Report
- Modify Styles in PDF Templates
- Modify Styles in Microsoft Word Templates
- Modify Styles in HTML Templates
- Add Holes in Microsoft Word Templates
- Add Holes in HTML and PDF Templates
- Fill Report Form Blanks
- Simplify Filling in Forms