Main Content

mlreportgen.dom.DOCXPageSize Class

Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.PageSize

(To be removed) Size and orientation of pages in Microsoft Word document

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.

This class is only compatible with this MATLAB® Report Generator™ output type: "docx".

The mlreportgen.dom.DOCXPageSize class is a handle class.

Creation

Description

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

example

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

Height of the page, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. For example, "11in" specifies eleven inches. Valid abbreviations are:

  • "px" — Pixels

  • "cm" — Centimeters

  • "in" — Inches

  • "mm" — Millimeters

  • "pc" — Picas

  • "pt" — Points

You can also specify pixels by omitting the unit. For example, "5" specifies 5 pixels.

Example: "11in"

Width of the page, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. For example, "8.5in" specifies 8.5 inches. Valid abbreviations are:

  • "px" — Pixels

  • "cm" — Centimeters

  • "in" — Inches

  • "mm" — Millimeters

  • "pc" — Picas

  • "pt" — Points

You can also specify pixels by omitting the unit. For example, "5" specifies 5 pixels.

Example: "8.5in"

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

Properties

expand all

Height of pages, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. For example, "11in" specifies 11 inches. Valid abbreviations are:

  • "px" — Pixels

  • "cm" — Centimeters

  • "in" — Inches

  • "mm" — Millimeters

  • "pc" — Picas

  • "pt" — Points

You can also specify pixels by omitting the unit. For example, "5" specifies 5 pixels.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Width of pages, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. For example, "8.5in" specifies 8.5 inches. Valid abbreviations are:

  • "px" — Pixels

  • "cm" — Centimeters

  • "in" — Inches

  • "mm" — Millimeters

  • "pc" — Picas

  • "pt" — Points

You can also specify pixels by omitting the unit. For example, "5" specifies 5 pixels.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Orientation of pages, specified as one of these character vectors or string scalars:

  • "portrait" for vertical orientation

  • "landscape" for horizontal orientation

The Height and Width properties determine the page orientation, regardless of the value of the Orientation property. However, it is a best practice to set the Orientation property to a value that is consistent with the page dimensions. If the height is greater than the width, set the Orientation to "portrait". If the width is greater than the height, set the Orientation to "landscape".

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Tag, 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. Use this value to help identify where an issue occurs during document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Object identifier, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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.CurrentPageLayout;
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");

Version History

Introduced in R2014b