Main Content

mlreportgen.dom.DOCXSection class

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

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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.

Parent of this document element, specified as a DOM object. This property is read-only.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

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://www.ecma-international.org/publications-and-standards/standards/ecma-376/.

The formats you specify using this property override corresponding formats defined by the style sheet style specified by the StyleName property. The DOM interface ignores formats that do not apply to this element.

Tag for this document element, specified as a character vector or string scalar.

The DOM 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. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Attributes:

GetAccess
public
SetAccess
public
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