Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 te document, returned as an mlreportgen.dom.PageSize object.

Properties

expand all

Height of pages in this section, 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. 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 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.

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

expand 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

Was this topic helpful?