Main Content

mlreportgen.dom.DOCXPageFooter class

Package:mlreportgen.dom
Superclasses:

Page footer definition forMicrosoftWorddocument

Description

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

Construction

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.

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.

输入参数

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. SetpageTypetodefaultfor one and toevenfor the other.

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

Name of this part’s template if it is stored in a template specified by thetemplatePathortemplateSrcargument, specified as a character vector.

Document or document part object whose template contains the template for this document part, specified as anmlreportgen.dom.Documentobject for a document or anmlreportgen.dom.DocumentPartobject for a document part.

Output Arguments

expand all

Page footer for a Word document, returned as anmlreportgen.dom.DOCXPageFooterobject.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

This property does not apply to page footers.

This read-only property is the hole ID of the current hole in this document.

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,AutoNumber.

  • A block hole can contain aParagraph,Table,OrderedList,UnorderedList,DocumentPart, orGroup.

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.

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 withpageTypeset todefaultand the other withpageTypeset toeven.

Parent of this document element, specified as a DOM object. This property is read-only.

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 theIdproperty of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Full path to the template to use for this footer, specified as a character vector.

Methods

UseDocumentPageFootermethods as you use the correspondingDocumentmethods.

Method

Purpose

append

Append one of these DOM objects to the footer:

  • CustomElement

  • FormalTable

  • Group

  • ExternalLink

  • Image

  • InternalLink

  • OrderedList

  • Paragraph

  • RawText

  • Table

  • Text

  • UnorderedList

close

Close the footer.

fill

Fill the template hole.

moveToNextHole

Move to the next template hole.

open

Open the footer.

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.

importmlreportgen.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 layoutfirstfooter = DOCXPageFooter('first'); evenfooter = DOCXPageFooter('even'); oddfooter = DOCXPageFooter('default'); d.CurrentPageLayout.PageFooters = [firstfooter,evenfooter,oddfooter];% Add title to first page footerp = Paragraph('My Document Title'); p.HAlign ='center';追加(d.CurrentPageLayout.PageFooters(1),p);% Add page number to even page footer% Align even page numbers leftpg2 = Page(); p2 = Paragraph(); p2.HAlign ='left';追加(p2, pg2);追加(d.CurrentPageLayout.PageFooters(2),p2);% Add page number to odd page footer% Align odd page numbers rightpg3 = 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);