Main Content

mlreportgen.dom.DOCXPageLayout class

Package:mlreportgen.dom

Page format and layout for section ofMicrosoftWorddocument

Description

Use anmlreportgen.dom.DOCXPageLayoutobject to define the page format, headers, and footers of a section of a Word document.

Themlreportgen.dom.DOCXPageLayoutclass is ahandleclass.

Class Attributes

HandleCompatible
true
ConstructOnLoad
true

For information on class attributes, seeClass Attributes.

Creation

Description

example

pageLayoutObj= mlreportgen.dom.DOCXPageLayout()creates aDOCXPageLayoutobject with defaultpropertyvalues.

Properties

expand all

Page headers for this layout, specified as an array ofmlreportgen.dom.DOCXPageHeaderobjects. You can define up to three page headers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

Page footers for this layout, specified as an array ofmlreportgen.dom.DOCXPageFooterobjects. You can define up to three page footers for a layout, one each for:

  • The first page of the section

  • Even pages

  • Odd pages

XML markup for unsupported layout formats, specified as a cell array of character vectors. For information about XML markup for Word formats, seehttps://www.ecma-international.org/publications-and-standards/standards/ecma-376/.

Sizes of the margins, header, footer, and gutter for this page layout, specified as anmlreportgen.dom.PageMarginsobject.

Size of pages in this layout, specified as anmlreportgen.dom.PageSizeobject.

Page borders for this layout, specified as anmlreportgen.dom.PageBorderobject.

一段的第一个页面,指定一个s an integer.

Type of page numbering to use, specified as one of the character vectors or string scalars in the table.

Value Meaning Applies To
DOCX PDF
'a' Lowercase alphabetic
'A' Uppercase alphabetic
'i' Lowercase Roman numerals
'I' Uppercase Roman numerals
'n',“N”,'1','decimal' Arabic numerals
'numberInDash' Number with dashes on either side
'hebrew1' Hebrew numerals
'hebrew2' Hebrew alphabetic
'arabicAlpha' Arabic alphabetic
'arabicAbjad' Arabic abjad numerals
'thaiLetters' Thai letters
'thaiNumbers' Thai numerals
'thaiCounting' Thai counting system

Section break options, specified as one of these character vectors or string scalars:

  • 'Next Page'— Start the section on the next page.

  • 'Same Page'— Start the section on the same page as the current section.

  • 'Odd Page'— Start the section on an odd page.

  • 'Even Page'— Start the section on an even page.

This property does not apply to page layouts.

Formats to apply to this layout, specified as an array of format objects. Formats that do not apply to a page layout are ignored.

Custom attributes of this document element, specified as an array ofmlreportgen.dom.CustomAttributeobjects. The custom attributes must be supported by the output format.

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

Children of this document element, specified as an array of DOM objects. This property is read-only.

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

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.

Methods

expand all

Examples

collapse all

Use theCurrentPageLayoutproperty of a document to access the layout object for the document. Change the left and right margins of the layout by setting theandRightproperties of themlreportgen.dom.PageMarginsobject used by the layout object.

importmlreportgen.dom.*; d = Document('mydoc','docx'); open(d); pageLayoutObject = d.CurrentPageLayout; pageLayoutObject.PageMargins.Left ='2in'; pageLayoutObject.PageMargins.Right ='2in'; p = Paragraph('Hello World'); append(d,p); close(d); rptview(d);

By default, aDOCXPageLayoutobject specifies a page with an 11-inch height, 8.5-half inch width, and portrait orientation. To change the orientation to landscape, use therotatemethod of theDOCXPageLayoutobject. The method updates the property values of the associatedmlreportgen.dom.PageSizeobject so that the height is 8.5 inches, the width is 11 inches, and the orientation is landscape.

importmlreportgen.dom.*; d = Document('myreport','docx'); open(d); pageLayoutObj = d.CurrentPageLayout; rotate(pageLayoutObj); append(d,'This document has landscape pages'); close(d); rptview(d);
Introduced in R2016a