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.PageMargins class

Package: mlreportgen.dom
Superclasses:

Page margins for Microsoft Word and PDF page layout

Description

Specifies the size of the page margins of a section of a Microsoft® Word or PDF document.

Word and PDF formats create page headers and footers differently. For example, PDF page headers and footers are fixed in size. Word headers and footers expand to fit the content. Therefore, the appearance of top and bottom page margins using the same values can differ based on the output format.

In addition, each format handles top and bottom margins differently. These differences can result in different page breaks even with the same margin settings.

  • For PDF, the total height of the top margin equals the value of the Top property of this object plus the height of the Header property. The body text starts below the header. For Word documents, the header and the body text can overlap.

  • Similarly, the total height of the PDF bottom margin equals the value of the Bottom property of this object plus the height of the Footer property. The body text ends above the footer. For Word documents, the footer can overlap the body text.

Construction

PageMarginsObj = PageMargins() specifies default page margins, which are one inch for the top, bottom, left, and right margins, and one-half inch for the gutter, header, and footer margins.

Output Arguments

expand all

Page margins, returned as an mlreportgen.dom.PageMargins object.

Properties

expand all

Width of the bottom margin, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Gutter size, specified in the form valueUnits, where Units is an abbreviation for the units to use. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Header size, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

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

Left margin size, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Right margin size, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

Top margin size, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Examples

expand all

Set the left and right margins for the current page layout to .5 inches.

import mlreportgen.dom.*;
d = Document('myreport','docx');
open(d);

s = d.CurrentPageLayout;
s.PageMargins.Left  = '.5in';
s.PageMargins.Right = '.5in';
append(d,'Left and right margins are .5 inch');

close(d);
rptview(d.OutputPath);

Introduced in R2016a

Was this topic helpful?