Main Content

mlreportgen.dom.DOCXSection Class

Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.DOCXPageLayout

(To be removed) Page format and layout for Microsoft Word document section

mlreportgen.dom.DOCXSection will be removed in a future release. Use mlreportgen.dom.DOCXPageLayout instead.

Description

Use an mlreportgen.dom.DOCXSection object to define the page format, headers, and footers of a Word document section.

If this is the first DOCXSection in a document, then it controls the page layout of all the document elements from the beginning of a document to this DOCXSection.

If this is the second or later DOCXSection in a document, then it controls the page layout of all the document elements from the preceding DOCXSection to itself.

Before you set properties (such as margin widths) of a DOCXSection object, open the Document object that contains the DOCXSection object.

The mlreportgen.dom.DOCXSection class is a handle class.

Creation

Description

docxSectionObj = DOCXSection creates an empty document section.

example

Properties

expand all

You can define up to three page headers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

You can define up to three page footers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

Sizes of the margins, header, footer, and gutter for this page layout, specified as an mlreportgen.dom.PageMargins object.

Attributes:

NonCopyable
true

Size of pages in layout, specified as an mlreportgen.dom.PageSize object.

Attributes:

NonCopyable
true

Page borders for layout, specified as an mlreportgen.dom.PageBorder object.

Attributes:

NonCopyable
true

XML markup for unsupported layout formats, specified as a cell array of character vectors or string scalars.

For information about XML markup for Word formats, see https://ecma-international.org/publications-and-standards/standards/ecma-376/.

Attributes:

NonCopyable
true

Data Types: cell | char | string

Format specification for this document element object, specified as an array of DOM format objects. The formats specified by this property override corresponding formats specified by the StyleName property of this element. Formats that do not apply to this document element object are ignored.

Attributes:

NonCopyable
true

Parent of mlreportgen.dom.DOCXSection object, specified as a document element object. A document element must have only one parent.

Attributes:

SetAccess
private
NonCopyable
true

Tag for the mlreportgen.dom.DOCXSection object, specified as a character vector or string scalar. The DOM API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for the mlreportgen.dom.DOCXSection object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

Create a Word report. The value of d.CurrentPageLayout is [].

import mlreportgen.dom.*;
d = Document("mydoc","docx");

Open the document, which generates a DOCXSection object from the default template and assigns the handle of the object to d.CurrentPageLayout.

open(d);

Assign a handle for the document DOCXSection object to the DOCXSection object s.

s = d.CurrentPageLayout;

Change the left margin of s.

s.PageMargins.Left = "0.5in";

Add some content and display the report.

p = Paragraph("Hello World");
append(d,p);

close(d);
rptview("mydoc.docx");

Version History

Introduced in R2014b