importHeadersAndFooters
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
importHeadersAndFooters
![](/img/preview/methods_check.png)
Imports headers and footers from an external Word document.
Description
public importHeadersAndFooters ( string $path [, string $type, array $options] )
This method allows the insertion of Headers and Footers from an external Word document in the current Word document.
If the type parameter is omitted both headers and footers are imported.
Parameters
path
The path to the external Word document.
type
The options are:.
- 'headerAndFooter' to import both header and footer (default value)
- 'header' for just the header
- 'footer' for just the footer
options
Key | Type | Description |
---|---|---|
setDefault | bool | If true, set as default the imported content. Default as false. |
Release notes
- phpdocx 13.0:
- improved multiple contents that include external relationships.
- in-memory DOCX documents.
- phpdocx 12.5:
- close ZIP file.
- phpdocx 12.0:
- setDefault option.