mlreportgen.dom.PageSize class

Package: mlreportgen.dom
Superclasses:

Size and orientation of pages in Microsoft Word and PDF documents

Description

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

Construction

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

PageSizeObj = PageSize(height,width) creates a portrait page having a specified height and width.

PageSizeObj = PageSize(height,width,orientation) creates a page having the specified height, width, and orientation.

Input Arguments

expand all

Height of the page, specified in the format valueUnits, where Units is one of these abbreviations:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Width of page, specified in the form valueUnits, where Units is one of these abbreviations:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Orientation of the page, specified as:

  • 'portrait' for vertical orientation

  • 'landscape' for horizontal orientation

Specify height and width values that match the orientation setting. For example, if the orientation is landscape, for 8.5x11-inch paper, set height to '8.5in' and width to '11in'.

Output Arguments

expand all

Page size and orientation of the document, returned as an mlreportgen.dom.PageSize object.

Properties

expand all

Height of pages, specified in the form valueUnits where Units is one of these abbreviations:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

Orientation of the page, specified as:

  • 'portrait' for vertical orientation

  • 'landscape' for horizontal orientation

Specify height and width values that match the orientation setting. For example, if the orientation is landscape, for 8.5x11-inch paper, set height to '8.5in' and width to '11in'.

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.

Width of page, specified in the form valueUnits, where Units is one of these abbreviations:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Examples

collapse all

Change the page orientation and size to landscape mode.

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(d.OutputPath);
Introduced in R2016a