Constants

ZIPARCHIVE

ZIPARCHIVE = 'ZipArchive'

Zip libraries

PCLZIP

PCLZIP = 'PclZip'

OLD_LIB

OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'

PDF_RENDERER_DOMPDF

PDF_RENDERER_DOMPDF = 'DomPDF'

PDF rendering libraries

PDF_RENDERER_TCPDF

PDF_RENDERER_TCPDF = 'TCPDF'

PDF_RENDERER_MPDF

PDF_RENDERER_MPDF = 'MPDF'

UNIT_TWIP

UNIT_TWIP = 'twip'

Measurement units multiplication factor

Applied to:

  • Section: margins, header/footer height, gutter, column spacing
  • Tab: position
  • Indentation: left, right, firstLine, hanging
  • Spacing: before, after

UNIT_CM

UNIT_CM = 'cm'

UNIT_MM

UNIT_MM = 'mm'

UNIT_INCH

UNIT_INCH = 'inch'

UNIT_POINT

UNIT_POINT = 'point'

UNIT_PICA

UNIT_PICA = 'pica'

DEFAULT_FONT_NAME

DEFAULT_FONT_NAME = 'Arial'

Default font settings

OOXML defined font size values in halfpoints, i.e. twice of what PhpWord use, and the conversion will be conducted during XML writing.

DEFAULT_FONT_SIZE

DEFAULT_FONT_SIZE = 10

DEFAULT_FONT_COLOR

DEFAULT_FONT_COLOR = '000000'

DEFAULT_FONT_CONTENT_TYPE

DEFAULT_FONT_CONTENT_TYPE = 'default'

Properties

$xmlWriterCompatibility

$xmlWriterCompatibility : boolean

Compatibility option for XMLWriter

Type

boolean

$zipClass

$zipClass : string

Name of the class used for Zip file management

Type

string

$pdfRendererName

$pdfRendererName : string

Name of the external Library used for rendering PDF files

Type

string

$pdfRendererPath

$pdfRendererPath : string

Directory Path to the external Library used for rendering PDF files

Type

string

$measurementUnit

$measurementUnit : integer|float

Measurement unit

Type

integer|float

$defaultFontName

$defaultFontName : string

Default font name

Type

string

$defaultFontSize

$defaultFontSize : integer

Default font size

Type

integer

$tempDir

$tempDir : string

The user defined temporary directory.

Type

string

$outputEscapingEnabled

$outputEscapingEnabled : boolean

Enables built-in output escaping mechanism.

Default value is false for backward compatibility with versions below 0.13.0.

Type

boolean

Methods

hasCompatibility()

hasCompatibility() : boolean

Return the compatibility option used by the XMLWriter

Returns

boolean —

Compatibility

setCompatibility()

setCompatibility(boolean  $compatibility) : boolean

Set the compatibility option used by the XMLWriter

This sets the setIndent and setIndentString for better compatibility

Parameters

boolean $compatibility

Returns

boolean

getZipClass()

getZipClass() : string

Get zip handler class

Returns

string

setZipClass()

setZipClass(string  $zipClass) : boolean

Set zip handler class

Parameters

string $zipClass

Returns

boolean

setPdfRenderer()

setPdfRenderer(string  $libraryName, string  $libraryBaseDir) : boolean

Set details of the external library for rendering PDF files

Parameters

string $libraryName
string $libraryBaseDir

Returns

boolean —

Success or failure

getPdfRendererName()

getPdfRendererName() : string

Return the PDF Rendering Library.

Returns

string

setPdfRendererName()

setPdfRendererName(string  $libraryName) : boolean

Identify the external library to use for rendering PDF files

Parameters

string $libraryName

Returns

boolean

getPdfRendererPath()

getPdfRendererPath() : string

Return the directory path to the PDF Rendering Library.

Returns

string

setPdfRendererPath()

setPdfRendererPath(string  $libraryBaseDir) : boolean

Location of external library to use for rendering PDF files

Parameters

string $libraryBaseDir

Directory path to the library's base folder

Returns

boolean —

Success or failure

getMeasurementUnit()

getMeasurementUnit() : string

Get measurement unit

Returns

string

setMeasurementUnit()

setMeasurementUnit(string  $value) : boolean

Set measurement unit

Parameters

string $value

Returns

boolean

setTempDir()

setTempDir(string  $tempDir) 

Sets the user defined path to temporary directory.

Parameters

string $tempDir

The user defined path to temporary directory

getTempDir()

getTempDir() : string

Returns path to temporary directory.

Returns

string

isOutputEscapingEnabled()

isOutputEscapingEnabled() : boolean

Returns

boolean

setOutputEscapingEnabled()

setOutputEscapingEnabled(boolean  $outputEscapingEnabled) 

Parameters

boolean $outputEscapingEnabled

getDefaultFontName()

getDefaultFontName() : string

Get default font name

Returns

string

setDefaultFontName()

setDefaultFontName(string  $value) : boolean

Set default font name

Parameters

string $value

Returns

boolean

getDefaultFontSize()

getDefaultFontSize() : integer

Get default font size

Returns

integer

setDefaultFontSize()

setDefaultFontSize(integer  $value) : boolean

Set default font size

Parameters

integer $value

Returns

boolean

loadConfig()

loadConfig(string  $filename = null) : array

Load setting from phpword.yml or phpword.yml.dist

Parameters

string $filename

Returns

array

getCompatibility()

getCompatibility() 

Return the compatibility option used by the XMLWriter