mlreportgen.dom.DOCXPageSize class

Package: mlreportgen.dom
Superclasses:

Size and orientation of pages in Microsoft Word document

Compatibility

Note

mlreportgen.dom.DOCXPageSize will be removed in a future release. Use mlreportgen.dom.PageSize instead.

Description

Specifies the height, width, and orientation of pages in a section of a Microsoft® Word document.

Construction

docxPageSizeObj = DOCXPageSize() creates a page size object having default values of 8.5-by-11 inches and portrait orientation.

docxPageSizeObj = DOCXPageSize(height,width) creates a portrait page having a specified height and width.

docxPageSizeObj = DOCXPageSize(height,width,orientation) creates a page having a specified height, width, and orientation.

Input Arguments

expand all

character vector specifying the height of the page. The character vector must have the format valueUnits where Units is an abbreviation for the units in which the width size is expressed. Valid abbreviations are:

  • no abbreviation — pixels

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • px — pixels

The character vector must have the format valueUnits, where Units is an abbreviation for the units in which the width size is expressed. Valid abbreviations are:

  • no abbreviation — pixels

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • px — pixels

Use one of these values:

  • 'portrait' (default)

  • 'landscape'

Specify height and width values that reflect the orientation setting. For example, if the orientation is landscape and the document is to be printed on 8.5x11-inch paper, set height to '8.5in' and width to '11in'.

Output Arguments

expand all

Page size and orientation of a Word document, represented by an mlreportgen.dom.DOCXPageSize object.

Properties

expand all

character vector specifying the page height. The character vector must have the format valueUnits where Units is an abbreviation for the units in which the width size is expressed. Valid abbreviations are:

  • no abbreviation — pixels

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • px — pixels

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.

Use one of these values:

  • 'portrait' (default)

  • 'landscape'

Specify height and width values that reflect the orientation setting. For example, if the orientation is landscape and the document is to be printed on 8.5x11-inch paper, set height to '8.5in' and width to '11in'.

Tag for the document element, specified as a character vector.

The DOM generates a session-unique tag when it creates the document element. Structure the tag as class:id, where class is the class of the element and id is the value of the Id property. You can specify a tag to replace the generated tag. Specifying your own tag can make it easier to identify where an issue occurred during document generation.

The character vector must have the format valueUnits, where Units is an abbreviation for the units in which the width size is expressed. Valid abbreviations are:

  • no abbreviation — pixels

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • px — pixels

Examples

collapse all

Change the page orientation and size specified by the default DOM template.

import mlreportgen.dom.*;
d = Document('myreport','docx');
open(d);
 
s = d.CurrentDOCXSection;
s.PageSize.Orientation  ='landscape';
s.PageSize.Height = '8.5in';
s.PageSize.Width = '11in';
append(d,'This document has landscape pages');

close(d);
rptview('myreport','docx');