importHeadersAndFooters

importHeadersAndFooters

TRIAL / ADVANCED / PREMIUM

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.
Code samples

Example #1

The resulting Word document looks like:

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.