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

example

docxSectionObj = DOCXSection creates an empty document section.

Properties

expand all

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

  • The first page of the section

  • Even pages

  • Odd pages

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

  • The first page of the section

  • Even pages

  • Odd pages

Margin sizes and page orientation in this section, specified as an mlreportgen.dom.DOCXPageMargins object.

Size of pages in this section, specified as an mlreportgen.dom.DOCXPageSize object.

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

Cell array of character vectors, with each character vector containing Word XML markup for a Word format. For information about XML markup for Word formats, see https://ecma-international.org/publications-and-standards/standards/ecma-376/.

Format specification for this document element object, specified as an array of 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 element are ignored.

Attributes:

NonCopyable
true

Data Types: cell

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 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 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