Main Content

mlreportgen.dom.DOCXPageFooter Class

Namespace: mlreportgen.dom

Page footer definition for Microsoft Word document

Description

Add a footer to the first page of a Word document layout or to odd pages, even pages, or both.

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

Creation

Description

docxFooter = DOCXPageFooter creates a page footer based on the default Word template.

docxFooter = DOCXPageFooter(pageType) creates a page footer for the specified type of page, that is, odd, even, or first, based on the default Word template.

example

docxFooter = DOCXPageFooter(pageType,templatePath) creates a page footer for the specified type of page based on the specified template.

docxFooter = DOCXPageFooter(pageType,templatePath,docPartTemplateName) creates a page footer for the specified type of page, based on the specified document part template in the specified template.

docxFooter = DOCXPageFooter(pageType,templateSrc,docPartTemplateName) creates a page footer for the specified type of page, based on the specified document part template from the specified source. The source can be a document or a document part.

Input Arguments

expand all

Type of pages the footer appears on, specified as one of these values:

  • default — Footer for odd pages of the section, even pages if you do not specify an even-page footer, and first page if you do not specify a first-page footer.

  • first — Footer for first page of a section.

  • even — Footer for even pages of a section.

For example, to make different footers appear on odd pages and on even pages, define two footers. Set pageType to default for one and to even for the other.

Full path of footer template, specified as a string scalar or a character vector.

Data Types: char | string

Name of this part’s template if it is stored in a template specified by the templatePath or templateSrc argument, specified as a character vector or string scalar.

Document or document part object whose template contains the template for this document part, specified as an mlreportgen.dom.Document object for a document or an mlreportgen.dom.DocumentPart object for a document part.

Properties

expand all

Children of mlreportgen.dom.DOCXPageFooter object, specified as an array of document element objects. This property contains the document element objects appended using the append method.

Attributes:

SetAccess
private
NonCopyable
true

This property does not apply to page footers.

Attributes:

SetAccess
private
Transient
true
NonCopyable
true

ID of the current hole in the document, specified as a character vector or string scalar.

Attributes:

SetAccess
private
Transient
true
NonCopyable
true

Data Types: char | string

Type of the current template hole, specified as "Inline" or "Block".

  • An inline hole is for document elements that a paragraph element can contain: Text, Image, LinkTarget, ExternalLink, InternalLink, CharEntity, or AutoNumber.

  • A block hole can contain a Paragraph, Table, OrderedList, UnorderedList, DocumentPart, or Group element.

Attributes:

SetAccess
private
Transient
true
NonCopyable
true

Data Types: char | string

Object identifier for the mlreportgen.dom.DOCXPageFooter 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

Type of page on which the footer appears, specified as one of these values:

  • default — Footer for odd pages of the section, even pages if you do not specify an even-page footer, and first page if you do not specify a first-page footer.

  • first — Footer for first page of a section.

  • even — Footer for even pages in a section.

To have a footer appear on odd pages and on even pages, define two footers, one with pageType set to default and the other with pageType set to even.

Parent of mlreportgen.dom.DOCXPageFooter object, specified as a document element object. A document element must have only one parent.

Attributes:

SetAccess
private
NonCopyable
true

Tag for the mlreportgen.dom.DOCXPageFooter 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

Full path of footer template, specified as a string scalar or a character vector.

Data Types: char | string

Methods

expand all

Examples

collapse all

This example defines first, even, and odd page footers in a Word document. It inserts a page number in each footer, using a different alignment for each page type.

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

% Create page footer objects for each type of page
% Assign a matrix of page footer objects to the current page layout
firstfooter = DOCXPageFooter('first');
evenfooter = DOCXPageFooter('even');
oddfooter = DOCXPageFooter('default');
d.CurrentPageLayout.PageFooters = [firstfooter,evenfooter,oddfooter];

% Add title to first page footer
p = Paragraph('My Document Title');
p.HAlign = 'center';
append(d.CurrentPageLayout.PageFooters(1),p);

% Add page number to even page footer
% Align even page numbers left
pg2 = Page();
p2 = Paragraph();
p2.HAlign = 'left';
append(p2,pg2);
append(d.CurrentPageLayout.PageFooters(2),p2);

% Add page number to odd page footer
% Align odd page numbers right
pg3 = Page();
p3 = Paragraph();
p3.HAlign = 'right';
append(p3,pg3);
append(d.CurrentPageLayout.PageFooters(3),p3);

% Create several pages.
p = Paragraph('Hello World');
append(d,p);
p = Paragraph('Another page');
p.Style = {PageBreakBefore(true)};
append(d,p);
append(d,clone(p));

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

Version History

Introduced in R2014b