Documentation

Settings
in package

PHPWord settings class.

Tags
since
0.8.0

Table of Contents

Constants

DEFAULT_FONT_COLOR  = '000000'
DEFAULT_FONT_CONTENT_TYPE  = 'default'
DEFAULT_FONT_NAME  = 'Arial'
Default font settings.
DEFAULT_FONT_SIZE  = 10
DEFAULT_PAPER  = 'A4'
OLD_LIB  = \PhpOffice\PhpWord\Shared\ZipArchive::class
PCLZIP  = 'PclZip'
PDF_RENDERER_DOMPDF  = 'DomPDF'
PDF rendering libraries.
PDF_RENDERER_MPDF  = 'MPDF'
PDF_RENDERER_TCPDF  = 'TCPDF'
UNIT_CM  = 'cm'
UNIT_INCH  = 'inch'
UNIT_MM  = 'mm'
UNIT_PICA  = 'pica'
UNIT_POINT  = 'point'
UNIT_TWIP  = 'twip'
Measurement units multiplication factor.
ZIPARCHIVE  = 'ZipArchive'
Zip libraries.

Properties

$defaultFontName  : string
Default font name.
$defaultFontSize  : float|int
Default font size.
$defaultPaper  : string
Default paper.
$defaultRtl  : bool|null
Is RTL by default ?
$measurementUnit  : string
Measurement unit.
$outputEscapingEnabled  : bool
Enables built-in output escaping mechanism.
$pdfRendererName  : null|string
Name of the external Library used for rendering PDF files.
$pdfRendererOptions  : array<string|int, mixed>
Options used for rendering PDF files.
$pdfRendererPath  : null|string
Directory Path to the external Library used for rendering PDF files.
$tempDir  : string
The user defined temporary directory.
$xmlWriterCompatibility  : bool
Compatibility option for XMLWriter.
$zipClass  : string
Name of the class used for Zip file management.

Methods

getDefaultFontName()  : string
Get default font name.
getDefaultFontSize()  : float|int
Get default font size.
getDefaultPaper()  : string
Get default paper.
getMeasurementUnit()  : string
Get measurement unit.
getPdfRendererName()  : string|null
Return the PDF Rendering Library.
getPdfRendererOptions()  : array<string|int, mixed>
Return the PDF Rendering Options.
getPdfRendererPath()  : string|null
Return the directory path to the PDF Rendering Library.
getTempDir()  : string
Returns path to temporary directory.
getZipClass()  : string
Get zip handler class.
hasCompatibility()  : bool
Return the compatibility option used by the XMLWriter.
isDefaultRtl()  : bool|null
isOutputEscapingEnabled()  : bool
loadConfig()  : array<string|int, mixed>
Load setting from phpword.yml or phpword.yml.dist.
setCompatibility()  : bool
Set the compatibility option used by the XMLWriter.
setDefaultFontName()  : bool
Set default font name.
setDefaultFontSize()  : bool
Set default font size.
setDefaultPaper()  : bool
Set default paper.
setDefaultRtl()  : void
setMeasurementUnit()  : bool
Set measurement unit.
setOutputEscapingEnabled()  : void
setPdfRenderer()  : bool
Set details of the external library for rendering PDF files.
setPdfRendererName()  : bool
Identify the external library to use for rendering PDF files.
setPdfRendererOptions()  : void
Set options of the external library for rendering PDF files.
setPdfRendererPath()  : bool
Location of external library to use for rendering PDF files.
setTempDir()  : void
Sets the user defined path to temporary directory.
setZipClass()  : bool
Set zip handler class.

Constants

DEFAULT_FONT_COLOR

public mixed DEFAULT_FONT_COLOR = '000000'

DEFAULT_FONT_CONTENT_TYPE

public mixed DEFAULT_FONT_CONTENT_TYPE = 'default'

DEFAULT_FONT_NAME

Default font settings.

public mixed DEFAULT_FONT_NAME = 'Arial'

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

public mixed DEFAULT_FONT_SIZE = 10

DEFAULT_PAPER

public mixed DEFAULT_PAPER = 'A4'

OLD_LIB

public mixed OLD_LIB = \PhpOffice\PhpWord\Shared\ZipArchive::class

PDF_RENDERER_DOMPDF

PDF rendering libraries.

public mixed PDF_RENDERER_DOMPDF = 'DomPDF'
Tags
const

string

PDF_RENDERER_MPDF

public mixed PDF_RENDERER_MPDF = 'MPDF'

PDF_RENDERER_TCPDF

public mixed PDF_RENDERER_TCPDF = 'TCPDF'

UNIT_INCH

public mixed UNIT_INCH = 'inch'

UNIT_PICA

public mixed UNIT_PICA = 'pica'

UNIT_POINT

public mixed UNIT_POINT = 'point'

UNIT_TWIP

Measurement units multiplication factor.

public mixed UNIT_TWIP = 'twip'

Applied to:

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

string

ZIPARCHIVE

Zip libraries.

public mixed ZIPARCHIVE = 'ZipArchive'
Tags
const

string

Properties

$defaultFontName

Default font name.

private static string $defaultFontName = self::DEFAULT_FONT_NAME

$defaultFontSize

Default font size.

private static float|int $defaultFontSize = self::DEFAULT_FONT_SIZE

$defaultPaper

Default paper.

private static string $defaultPaper = self::DEFAULT_PAPER

$defaultRtl

Is RTL by default ?

private static bool|null $defaultRtl

$measurementUnit

Measurement unit.

private static string $measurementUnit = self::UNIT_TWIP

$outputEscapingEnabled

Enables built-in output escaping mechanism.

private static bool $outputEscapingEnabled = false

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

$pdfRendererName

Name of the external Library used for rendering PDF files.

private static null|string $pdfRendererName

$pdfRendererOptions

Options used for rendering PDF files.

private static array<string|int, mixed> $pdfRendererOptions = []

$pdfRendererPath

Directory Path to the external Library used for rendering PDF files.

private static null|string $pdfRendererPath

$tempDir

The user defined temporary directory.

private static string $tempDir = ''

$xmlWriterCompatibility

Compatibility option for XMLWriter.

private static bool $xmlWriterCompatibility = true

$zipClass

Name of the class used for Zip file management.

private static string $zipClass = self::ZIPARCHIVE

Methods

getDefaultFontName()

Get default font name.

public static getDefaultFontName() : string
Return values
string

getDefaultFontSize()

Get default font size.

public static getDefaultFontSize() : float|int
Return values
float|int

getDefaultPaper()

Get default paper.

public static getDefaultPaper() : string
Return values
string

getMeasurementUnit()

Get measurement unit.

public static getMeasurementUnit() : string
Return values
string

getPdfRendererName()

Return the PDF Rendering Library.

public static getPdfRendererName() : string|null
Return values
string|null

getPdfRendererOptions()

Return the PDF Rendering Options.

public static getPdfRendererOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPdfRendererPath()

Return the directory path to the PDF Rendering Library.

public static getPdfRendererPath() : string|null
Return values
string|null

getTempDir()

Returns path to temporary directory.

public static getTempDir() : string
Tags
since
0.12.0
Return values
string

getZipClass()

Get zip handler class.

public static getZipClass() : string
Return values
string

hasCompatibility()

Return the compatibility option used by the XMLWriter.

public static hasCompatibility() : bool
Return values
bool

Compatibility

isDefaultRtl()

public static isDefaultRtl() : bool|null
Return values
bool|null

isOutputEscapingEnabled()

public static isOutputEscapingEnabled() : bool
Tags
since
0.13.0
Return values
bool

loadConfig()

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

public static loadConfig([string|null $filename = null ]) : array<string|int, mixed>
Parameters
$filename : string|null = null
Return values
array<string|int, mixed>

setCompatibility()

Set the compatibility option used by the XMLWriter.

public static setCompatibility(bool $compatibility) : bool

This sets the setIndent and setIndentString for better compatibility.

Parameters
$compatibility : bool
Return values
bool

setDefaultFontName()

Set default font name.

public static setDefaultFontName(string $value) : bool
Parameters
$value : string
Return values
bool

setDefaultFontSize()

Set default font size.

public static setDefaultFontSize(null|float|int $value) : bool
Parameters
$value : null|float|int
Return values
bool

setDefaultPaper()

Set default paper.

public static setDefaultPaper(string $value) : bool
Parameters
$value : string
Return values
bool

setDefaultRtl()

public static setDefaultRtl(bool|null $defaultRtl) : void
Parameters
$defaultRtl : bool|null

setMeasurementUnit()

Set measurement unit.

public static setMeasurementUnit(string $value) : bool
Parameters
$value : string
Return values
bool

setOutputEscapingEnabled()

public static setOutputEscapingEnabled(bool $outputEscapingEnabled) : void
Parameters
$outputEscapingEnabled : bool
Tags
since
0.13.0

setPdfRenderer()

Set details of the external library for rendering PDF files.

public static setPdfRenderer(string $libraryName, string $libraryBaseDir) : bool
Parameters
$libraryName : string
$libraryBaseDir : string
Return values
bool

Success or failure

setPdfRendererName()

Identify the external library to use for rendering PDF files.

public static setPdfRendererName(string|null $libraryName) : bool
Parameters
$libraryName : string|null
Return values
bool

setPdfRendererOptions()

Set options of the external library for rendering PDF files.

public static setPdfRendererOptions(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>

setPdfRendererPath()

Location of external library to use for rendering PDF files.

public static setPdfRendererPath(null|string $libraryBaseDir) : bool
Parameters
$libraryBaseDir : null|string

Directory path to the library's base folder

Return values
bool

Success or failure

setTempDir()

Sets the user defined path to temporary directory.

public static setTempDir(string $tempDir) : void
Parameters
$tempDir : string

The user defined path to temporary directory

Tags
since
0.12.0

setZipClass()

Set zip handler class.

public static setZipClass(string $zipClass) : bool
Parameters
$zipClass : string
Return values
bool

        
On this page

Search results