mlreportgen.dom.PageBorder Class
Namespace: mlreportgen.dom
Description
Use an object of the mlreportgen.dom.PageBorder
class to specify page
borders for Microsoft® Word and PDF reports.
The mlreportgen.dom.PageBorder
class is a handle
class.
Class Attributes
ConstructOnLoad | true |
HandleCompatible | true |
For information on class attributes, see Class Attributes.
Creation
Description
creates a pageBorder
= mlreportgen.dom.PageBorderPageBorder
object with default properties where all the segments
are solid, black, and 0.5 point wide, the top and bottom segments are one point from the
page margins, and the left and right segments are four points from the page
margins.
specifies the default style for all border segments and sets the pageBorder
= mlreportgen.dom.PageBorder(style
)Style
property to style
.
also specifies the default color for all border segments and sets the pageBorder
= mlreportgen.dom.PageBorder(style
,color
)Color
property to color
.
also specifies the default width for all border segments and sets the pageBorder
= mlreportgen.dom.PageBorder(style
,color
,width
)Width
property to width
.
Properties
Style
— Default style of page border segments
"solid"
(default) | "single"
| "dashed"
| ...
Default style of the page border segments, specified as one of the values in the table.
Border Style | Description | Supported Output Types | Supports PDF |
---|---|---|---|
"dashed" | Dashed line | yes | yes |
"dashdotstroked" | Line with alternating diagonal dashes and dot | yes | no |
"dashsmallgap" | Dashed line with a small gap between dashes | yes | no |
"dotted" | Dotted line | yes | yes |
"dotdash" | Line with alternating dots and dashes | yes | no |
"dotdotdash" | Line with alternating double dots and a dash | yes | no |
"double" | Double line | yes | yes |
"doublewave" | Double wavy line | yes | no |
"inset" | 3-D effect line | yes | yes |
"none" | No border | yes | yes |
"outset" | 3-D effect line | yes | yes |
"single" | Single line | yes | |
"solid" | Single line | no | yes |
"thick" | Thick line | yes | no |
"thickthinlargegap" | Dashed line with alternating thick and thin dashes with a large gap | yes | no |
"thickthinmediumgap" | Dashed line with alternating thick and thin dashes with a medium gap | yes | no |
"thickthinsmallgap" | Dashed line with alternating thick and thin dashes with a small gap | yes | no |
"thinthicklargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthicksmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"thinthickthinlargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickthinmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthickthinsmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"threedemboss" | Embossed effect line | yes | no |
"threedengrave" | Engraved effect line | yes | no |
"triple" | Triple line | yes | no |
"wave" | Wavy line | yes | no |
Attributes:
NonCopyable | true |
Color
— Default color of page border segments
"black"
(default) | character vector | string scalar
Default color of the border segments, specified as a character vector or string scalar that contains the color name or equivalent hexadecimal RGB specification. See https://www.w3.org/TR/2018/REC-css-color-3-20180619/.
Example: "red"
Example: "#FF0000"
Attributes:
NonCopyable | true |
Width
— Default width of page border segments
"0.5pt"
(default) | character vector | string scalar
Default width of the page border segments, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "1pt" specifies one point. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
Note
Whether Word honors the Width
setting depends on the style
specified by the Style
property. For example, Word supports only 0.75-point and 1.5-point widths for the
wave
style. To see the widths that Word supports for a border
style, in Word, on the Design tab, under Page
Background, select Page Borders. Select a
border under Style, then click the Width
list to see the available widths.
Example: "0.5pt"
Attributes:
NonCopyable | true |
Margin
— Default margin of page border segments
[]
(default) | character vector | string scalar
Default margin of the page border segments, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "10pt" specifies ten points. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF documents, the margin of a border segment is the space between the segment
and the page margin. For Word documents, the margin of a border segment is the space
between the segment and the page margin or between the segment and the edge of the page,
depending on the value of the MeasureFrom
property.
For Word documents, the Margin
value must between 0 points and
31 points, or the equivalent value using other units of measurement.
Example: "10pt"
Attributes:
NonCopyable | true |
MeasureFrom
— Whether border position is measured from page margin or edge of page
"text"
(default) | "pageboundary"
Whether the border position is measured from the edge of the page or the edge of the
page margin, which is the edge of the text, specified as "text"
or
"pageboundary"
. The "pageboundary"
value applies
only to Word documents. For a PDF document, the page border is always measured from the
page margin.
If the value is "text"
, the Margin
,
TopMargin
, LeftMargin
, BottomMargin
, and RightMargin
properties specify the distance between a border segment and
the page margin. For example, in this Word document, the page margin is one inch and the
border is twenty points from the page margin.
If the value is "pageboundary"
, the value of the
Margin
, TopMargin
,
LeftMargin
, BottomMargin
, and
RightMargin
properties specify the distance between the border
and the edge of the page. For example, the border is 20 points from the edge of the page
in this Word document:
Attributes:
NonCopyable | true |
SurroundHeader
— Whether page border surrounds header region
true
(default) | false
Whether the page border surrounds the header region, specified as
true
or false
. This property applies to PDF
documents or to Word documents when the MeasureFrom
property is set to "text".
If the value is true
, the border surrounds the header. For
example, the border surrounds the header in this Word document:
If the value is false
, the border does not surround the header.
For example, The border does not surround the header in this Word document:
Note
For Word documents with multiple sections, a false
value for
the SurroundHeader
property, or the equivalent setting in a
template, applies to all sections of the document. If you specify that a page border
does not surround the header for one section of the document, a page border does not
surround the header for any section.
Attributes:
NonCopyable | true |
SurroundFooter
— Whether page border surrounds footer region
true
(default) | false
Whether the page border surrounds the footer region, specified as
true
or false
. This property applies to PDF
documents or to Word documents when the MeasureFrom
property is set to "text".
If the value is true
, the border surrounds the footer. For
example, the border surrounds the footer in this Word document:
If the value is false
, the border does not surround the footer.
For example, the border does not surround the footer in this Word document:
Note
For Word documents with multiple sections, a false
value for
the SurroundFooter
property, or the equivalent setting in a
template, applies to all sections of the document. If you specify that a page border
does not surround the footer for one section of the document, a page border does not
surround the footer for any section.
Attributes:
NonCopyable | true |
TopStyle
— Style of top page border segment
"solid"
(default) | "single"
| "dashed"
| ...
Style of the top page border segment, specified as one of the values in the table.
Border Style | Description | Supported Output Types | Supports PDF |
---|---|---|---|
"dashed" | Dashed line | yes | yes |
"dashdotstroked" | Line with alternating diagonal dashes and dot | yes | no |
"dashsmallgap" | Dashed line with a small gap between dashes | yes | no |
"dotted" | Dotted line | yes | yes |
"dotdash" | Line with alternating dots and dashes | yes | no |
"dotdotdash" | Line with alternating double dots and a dash | yes | no |
"double" | Double line | yes | yes |
"doublewave" | Double wavy line | yes | no |
"inset" | 3-D effect line | yes | yes |
"none" | No border | yes | yes |
"outset" | 3-D effect line | yes | yes |
"single" | Single line | yes | |
"solid" | Single line | no | yes |
"thick" | Thick line | yes | no |
"thickthinlargegap" | Dashed line with alternating thick and thin dashes with a large gap | yes | no |
"thickthinmediumgap" | Dashed line with alternating thick and thin dashes with a medium gap | yes | no |
"thickthinsmallgap" | Dashed line with alternating thick and thin dashes with a small gap | yes | no |
"thinthicklargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthicksmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"thinthickthinlargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickthinmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthickthinsmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"threedemboss" | Embossed effect line | yes | no |
"threedengrave" | Engraved effect line | yes | no |
"triple" | Triple line | yes | no |
"wave" | Wavy line | yes | no |
Attributes:
NonCopyable | true |
TopColor
— Color of top border segment
'black'
(default) | character vector | string scalar
Color of the top border segment, specified as a character vector or string scalar that contains the color name or equivalent hexadecimal RGB specification. See https://www.w3.org/TR/2018/REC-css-color-3-20180619/.
Example: "red"
Example: "#FF0000"
Attributes:
NonCopyable | true |
TopWidth
— Width of top border segment
'0.5pt'
(default) | character vector | string scalar
Width of the top border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "1pt" specifies one point. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
Note
Whether Word honors the TopWidth
setting depends on the style
specified by the TopStyle
property. For example, Word supports only 0.75-point and
1.5-point widths for the wave
style. To see the widths that Word
supports for a border style, in Word, on the Design tab, under
Page Background, select Page
Borders. Select a border under Style, then click
the Width list to see the available widths.
Example: "1pt"
Attributes:
NonCopyable | true |
TopMargin
— Margin of top border segment
'1pt'
(default) | character vector | string scalar
Margin of the top border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "10pt" specifies ten points. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF documents, the margin of a border segment is the space between the segment
and the page margin. For Word documents, the margin of a border segment is the space
between the segment and the page margin or between the segment and the edge of the page,
depending on the value of the MeasureFrom
property.
For Word documents, the TopMargin
value must between 0 points
and 31 points, or the equivalent value using other units of measurement.
Example: "10pt"
Attributes:
NonCopyable | true |
LeftStyle
— Style of left border segment
"solid"
(default) | "single"
| "dashed"
| ...
Style of the left border segment, specified as one of the values in the table.
Border Style | Description | Supported Output Types | Supports PDF |
---|---|---|---|
"dashed" | Dashed line | yes | yes |
"dashdotstroked" | Line with alternating diagonal dashes and dot | yes | no |
"dashsmallgap" | Dashed line with a small gap between dashes | yes | no |
"dotted" | Dotted line | yes | yes |
"dotdash" | Line with alternating dots and dashes | yes | no |
"dotdotdash" | Line with alternating double dots and a dash | yes | no |
"double" | Double line | yes | yes |
"doublewave" | Double wavy line | yes | no |
"inset" | 3-D effect line | yes | yes |
"none" | No border | yes | yes |
"outset" | 3-D effect line | yes | yes |
"single" | Single line | yes | |
"solid" | Single line | no | yes |
"thick" | Thick line | yes | no |
"thickthinlargegap" | Dashed line with alternating thick and thin dashes with a large gap | yes | no |
"thickthinmediumgap" | Dashed line with alternating thick and thin dashes with a medium gap | yes | no |
"thickthinsmallgap" | Dashed line with alternating thick and thin dashes with a small gap | yes | no |
"thinthicklargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthicksmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"thinthickthinlargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickthinmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthickthinsmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"threedemboss" | Embossed effect line | yes | no |
"threedengrave" | Engraved effect line | yes | no |
"triple" | Triple line | yes | no |
"wave" | Wavy line | yes | no |
Attributes:
NonCopyable | true |
LeftColor
— Color of left border segment
'black'
(default) | character vector | string scalar
Color of the left border segment, specified as a character vector or string scalar that contains the color name or equivalent hexadecimal RGB specification. See https://www.w3.org/TR/2018/REC-css-color-3-20180619/.
Example: "red"
Example: "#FF0000"
Attributes:
NonCopyable | true |
LeftWidth
— Width of left border segment
'0.5pt'
(default) | character vector | string scalar
Width of the left border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "1pt" specifies one point. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
Note
Whether Word honors the LeftWidth
setting depends on the
style specified by the LeftStyle
property. For example, Word supports only 0.75-point and
1.5-point widths for the wave
style. To see the widths that Word
supports for a border style, in Word, on the Design tab, under
Page Background, select Page
Borders. Select a border under Style, then click
the Width list to see the available widths.
Example: "1pt"
Attributes:
NonCopyable | true |
LeftMargin
— Margin of left border segment
'4pt'
(default) | character vector | string scalar
Margin of the left border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "10pt" specifies ten points. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF documents, the margin of a border segment is the space between the segment
and the page margin. For Word documents, the margin of a border segment is the space
between the segment and the page margin or between the segment and the edge of the page,
depending on the value of the MeasureFrom
property.
For Word documents, the LeftMargin
value must between 0 points
and 31 points, or the equivalent value using other units of measurement.
Example: "10pt"
Attributes:
NonCopyable | true |
BottomStyle
— Style of bottom border segment
"solid"
(default) | "single"
| "dashed"
| ...
Style of the bottom border segment, specified as one of the values in the table.
Border Style | Description | Supported Output Types | Supports PDF |
---|---|---|---|
"dashed" | Dashed line | yes | yes |
"dashdotstroked" | Line with alternating diagonal dashes and dot | yes | no |
"dashsmallgap" | Dashed line with a small gap between dashes | yes | no |
"dotted" | Dotted line | yes | yes |
"dotdash" | Line with alternating dots and dashes | yes | no |
"dotdotdash" | Line with alternating double dots and a dash | yes | no |
"double" | Double line | yes | yes |
"doublewave" | Double wavy line | yes | no |
"inset" | 3-D effect line | yes | yes |
"none" | No border | yes | yes |
"outset" | 3-D effect line | yes | yes |
"single" | Single line | yes | |
"solid" | Single line | no | yes |
"thick" | Thick line | yes | no |
"thickthinlargegap" | Dashed line with alternating thick and thin dashes with a large gap | yes | no |
"thickthinmediumgap" | Dashed line with alternating thick and thin dashes with a medium gap | yes | no |
"thickthinsmallgap" | Dashed line with alternating thick and thin dashes with a small gap | yes | no |
"thinthicklargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthicksmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"thinthickthinlargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickthinmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthickthinsmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"threedemboss" | Embossed effect line | yes | no |
"threedengrave" | Engraved effect line | yes | no |
"triple" | Triple line | yes | no |
"wave" | Wavy line | yes | no |
Attributes:
NonCopyable | true |
BottomColor
— Color of bottom border segment
'black'
(default) | character vector | string scalar
Color of the bottom border segment, specified as a character vector or string scalar that contains the color name or equivalent hexadecimal RGB specification. See https://www.w3.org/TR/2018/REC-css-color-3-20180619/.
Example: "red"
Example: "#FF0000"
Attributes:
NonCopyable | true |
BottomWidth
— Width of bottom border segment
'0.5pt'
(default) | character vector | string scalar
Width of the bottom border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "1pt" specifies one point. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
Note
Whether Word honors the BottomWidth
setting depends on the
style specified by the BottomStyle
property. For example, Word supports only 0.75-point and
1.5-point widths for the wave
style. To see the widths that Word
supports for a border style, in Word, on the Design tab, under
Page Background, select Page
Borders. Select a border under Style, then click
the Width list to see the available widths.
Example: "1pt"
Attributes:
NonCopyable | true |
BottomMargin
— Margin of bottom border segment
'1pt'
(default) | character vector | string scalar
Margin of the bottom border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "10pt" specifies ten points. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF documents, the margin of a border segment is the space between the segment
and the page margin. For Word documents, the margin of a border segment is the space
between the segment and the page margin or between the segment and the edge of the page,
depending on the value of the MeasureFrom
property.
For Word documents, the BottomMargin
value must between 0
points and 31 points, or the equivalent value using other units of measurement.
Example: "10pt"
Attributes:
NonCopyable | true |
RightStyle
— Style of right border segment
"solid"
(default) | "single"
| "dashed"
| ...
Style of the right border segment, specified as one of the values in the table.
Border Style | Description | Supported Output Types | Supports PDF |
---|---|---|---|
"dashed" | Dashed line | yes | yes |
"dashdotstroked" | Line with alternating diagonal dashes and dot | yes | no |
"dashsmallgap" | Dashed line with a small gap between dashes | yes | no |
"dotted" | Dotted line | yes | yes |
"dotdash" | Line with alternating dots and dashes | yes | no |
"dotdotdash" | Line with alternating double dots and a dash | yes | no |
"double" | Double line | yes | yes |
"doublewave" | Double wavy line | yes | no |
"inset" | 3-D effect line | yes | yes |
"none" | No border | yes | yes |
"outset" | 3-D effect line | yes | yes |
"single" | Single line | yes | |
"solid" | Single line | no | yes |
"thick" | Thick line | yes | no |
"thickthinlargegap" | Dashed line with alternating thick and thin dashes with a large gap | yes | no |
"thickthinmediumgap" | Dashed line with alternating thick and thin dashes with a medium gap | yes | no |
"thickthinsmallgap" | Dashed line with alternating thick and thin dashes with a small gap | yes | no |
"thinthicklargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthicksmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"thinthickthinlargegap" | Dashed line with alternating thin and thick dashes with a large gap | yes | no |
"thinthickthinmediumgap" | Dashed line with alternating thin and thick dashes with a medium gap | yes | no |
"thinthickthinsmallgap" | Dashed line with alternating thin and thick dashes with a small gap | yes | no |
"threedemboss" | Embossed effect line | yes | no |
"threedengrave" | Engraved effect line | yes | no |
"triple" | Triple line | yes | no |
"wave" | Wavy line | yes | no |
Attributes:
NonCopyable | true |
RightColor
— Color of right border segment
'black'
(default) | character vector | string scalar
Color of the right border segment, specified as a character vector or string scalar that contains the color name or equivalent hexadecimal RGB specification. See https://www.w3.org/TR/2018/REC-css-color-3-20180619/.
Example: "red"
Example: "#FF0000"
Attributes:
NonCopyable | true |
RightWidth
— Width of right border segment
'0.5pt'
(default) | character vector | string scalar
Width of the right border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "1pt" specifies one point. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
Note
Whether Word honors the RightWidth
setting depends on the
style specified by the RightStyle
property. For example, Word supports only 0.75-point and
1.5-point widths for the wave
style. To see the widths that Word
supports for a border style, in Word, on the Design tab, under
Page Background, select Page
Borders. Select a border under Style, then click
the Width list to see the available widths.
Example: "1pt"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
RightMargin
— Margin of right border segment
'4pt'
(default) | character vector | string scalar
Margin of the right border segment, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, "10pt" specifies ten points. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF documents, the margin of a border segment is the space between the segment
and the page margin. For Word documents, the margin of a border segment is the space
between the segment and the page margin or between the segment and the edge of the page,
depending on the value of the MeasureFrom
property.
For Word documents, the RightMargin
value must between 0
points and 31 points, or the equivalent value using other units of measurement.
Example: "10pt"
Attributes:
NonCopyable | true |
Id
— Object identifier for mlreportgen.dom.PageBorder
object
character vector | string scalar
Object identifier for the mlreportgen.dom.PageBorder
object, specified as a
character vector or string scalar. The DOM API generates a session-unique identifier
when it creates the document element object. You can specify your own value for
Id
.
Attributes:
NonCopyable | true |
Data Types: char
| string
Tag
— Tag for mlreportgen.dom.PageBorder
object
character vector | string scalar
Tag for the mlreportgen.dom.PageBorder
object, 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. Specify your own tag value to help
you identify where to look when an issue occurs during document generation.
Attributes:
NonCopyable | true |
Data Types: char
| string
Examples
Generate a Microsoft Word Document with Page Borders
This example generates a Microsoft Word document that has solid, red, 0.5-point borders positioned 20 points from the page boundary.
Import the DOM API namespace so that you do not have to use long, fully qualified class names.
import mlreportgen.dom.*;
Create a Word document.
d = Document("myDocument","docx"); open(d);
Create a PageBorder
object and specify the border style, color, and width.
pageBorder = PageBorder("solid","red","0.5pt");
Specify that the border position is relative to the page boundary and specify the margin between the page boundary and the border.
pageBorder.MeasureFrom ="pageboundary"; pageBorder.Margin = "20pt";
Set the PageBorder
property of the layout associated with the document to the PageBorder
object.
d.CurrentPageLayout.PageBorder = pageBorder;
Add text to the document. Close and view the document.
append(d,"The solid, red, 0.5-point border is 20 points from the page boundary.");
close(d);
rptview(d);
Generate a PDF Document with Page Borders
This example generates a PDF document that has solid, red, 0.5-point borders positioned 20 points from the page margins.
Import the DOM API namespace so that you do not have to use long, fully qualified class names.
import mlreportgen.dom.*;
Create a PDF document.
d = Document("myDocument","pdf"); open(d);
Create a PageBorder
object and specify the style, color, width, and margin for all border segments. For PDF Documents, the margin of a border segment specifies the distance between the segment and the page margin.
pageBorder = PageBorder("solid","red","0.5pt","20pt");
Set the PageBorder
property of the layout associated with the document to the PageBorder
object.
d.CurrentPageLayout.PageBorder = pageBorder;
Add text to the document. Close and view the document.
append(d,"The solid, red, 0.5-point border segments are twenty points from the margins.");
close(d);
rptview(d);
Generate a Report API Report with Page Borders
This example uses the Report API to generate a Word or PDF report that has red page borders on the title page and blue page borders on the other sections of the report.
Import the Report API and DOM API packages so that you do not have to use long, fully qualified class names.
import mlreportgen.report.*; import mlreportgen.dom.*;
Create a Word report and specify solid, blue, 0.5-point default borders for all pages of the report. For a PDF report, replace "docx"
with "pdf"
.
rpt = Report("myreport","docx"); rpt.Layout.PageBorder = PageBorder("solid","blue","0.5pt");
Create a title page and specify solid, red, 0.5-point borders for the title page. Append the title page to the report.
tp = TitlePage("Title","My Report"); tp.Layout.PageBorder = PageBorder("solid","red","0.5pt"); append(rpt,tp);
Create a chapter and append it to the report.
ch = Chapter("My Chapter");
append(rpt,ch);
Close and view the report.
close(rpt); rptview(rpt);
In the generated report, the title page has red borders as specified by the title page reporter layout.
The chapter pages have the default blue borders because the chapter reporter layout did not specify page borders.
Version History
Introduced in R2021b
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)