This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mlreportgen.dom.DOCXSection class

Package: mlreportgen.dom
Superclasses:

Page format and layout for Microsoft Word document section

Note

mlreportgen.dom.DOCXSection will be removed in a future release. Use mlreportgen.dom.DOCXPageLayout for Word output and mlreportgen.dom.PDFPageLayout for PDF output 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.

Construction

docxSectionObj = DOCXSection() creates an empty document section.

Output Arguments

expand all

Page format and layout for Word document section, represented by an mlreportgen.dom.DOCXSection object.

Properties

expand all

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

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.

This read-only property lists the parent of this document element.

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/standards/Ecma-376.htm.

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 document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Examples

collapse all

Create a Word report. The value of d.CurrentDOCXSection 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.CurrentDOCXSection.

open(d);

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

s = d.CurrentDOCXSection;

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');