Constants

DEFAULT_FONT_NAME

DEFAULT_FONT_NAME = \PhpOffice\PhpWord\Settings::DEFAULT_FONT_NAME

Default font settings

DEFAULT_FONT_SIZE

DEFAULT_FONT_SIZE = \PhpOffice\PhpWord\Settings::DEFAULT_FONT_SIZE

DEFAULT_FONT_COLOR

DEFAULT_FONT_COLOR = \PhpOffice\PhpWord\Settings::DEFAULT_FONT_COLOR

DEFAULT_FONT_CONTENT_TYPE

DEFAULT_FONT_CONTENT_TYPE = \PhpOffice\PhpWord\Settings::DEFAULT_FONT_CONTENT_TYPE

Properties

$collections

$collections : array

Collections

Type

array

$metadata

$metadata : array

Metadata

Type

array

Methods

__construct()

__construct() 

Create new instance

Collections are created dynamically

__call()

__call(mixed  $function, mixed  $args) : mixed

Dynamic function call to reduce static dependency

Parameters

mixed $function
mixed $args

Throws

\BadMethodCallException

Returns

mixed

getSection()

getSection(integer  $index) : \PhpOffice\PhpWord\Element\Section|null

Returns the section at the requested position

Parameters

integer $index

Returns

\PhpOffice\PhpWord\Element\Section|null

sortSections()

sortSections(callable  $sorter) 

Sorts the sections using the callable passed

Parameters

callable $sorter

getDefaultFontName()

getDefaultFontName() : string

Get default font name

Returns

string

setDefaultFontName()

setDefaultFontName(string  $fontName) 

Set default font name.

Parameters

string $fontName

getDefaultFontSize()

getDefaultFontSize() : integer

Get default font size

Returns

integer

setDefaultFontSize()

setDefaultFontSize(integer  $fontSize) 

Set default font size.

Parameters

integer $fontSize

setDefaultParagraphStyle()

setDefaultParagraphStyle(array  $styles) : \PhpOffice\PhpWord\Style\Paragraph

Set default paragraph style definition to styles.xml

Parameters

array $styles

Paragraph style definition

Returns

\PhpOffice\PhpWord\Style\Paragraph

loadTemplate()

loadTemplate(string  $filename) : \PhpOffice\PhpWord\TemplateProcessor

Load template by filename

Parameters

string $filename

Fully qualified filename

Throws

\PhpOffice\PhpWord\Exception\Exception

Returns

\PhpOffice\PhpWord\TemplateProcessor

save()

save(string  $filename, string  $format = 'Word2007', boolean  $download = false) : boolean

Save to file or download

All exceptions should already been handled by the writers

Parameters

string $filename
string $format
boolean $download

Returns

boolean

createSection()

createSection(array  $settings = null) : \PhpOffice\PhpWord\Element\Section

Create new section

Parameters

array $settings

Returns

\PhpOffice\PhpWord\Element\Section

setDocumentProperties()

setDocumentProperties(\PhpOffice\PhpWord\Metadata\DocInfo  $documentProperties) : self

Set document properties object

Parameters

\PhpOffice\PhpWord\Metadata\DocInfo $documentProperties

Returns

self

getTitles()

getTitles() : \PhpOffice\PhpWord\Collection\Titles

Returns

\PhpOffice\PhpWord\Collection\Titles

getFootnotes()

getFootnotes() : \PhpOffice\PhpWord\Collection\Footnotes

Returns

\PhpOffice\PhpWord\Collection\Footnotes

getEndnotes()

getEndnotes() : \PhpOffice\PhpWord\Collection\Endnotes

Returns

\PhpOffice\PhpWord\Collection\Endnotes

getCharts()

getCharts() : \PhpOffice\PhpWord\Collection\Charts

Returns

\PhpOffice\PhpWord\Collection\Charts

getComments()

getComments() : \PhpOffice\PhpWord\Collection\Comments

Returns

\PhpOffice\PhpWord\Collection\Comments

addBookmark()

addBookmark(\Element\Bookmark  $bookmark) : integer

Parameters

\Element\Bookmark $bookmark

Returns

integer

addTitle()

addTitle(\Element\Title  $title) : integer

Parameters

\Element\Title $title

Returns

integer

addFootnote()

addFootnote(\Element\Footnote  $footnote) : integer

Parameters

\Element\Footnote $footnote

Returns

integer

addEndnote()

addEndnote(\Element\Endnote  $endnote) : integer

Parameters

\Element\Endnote $endnote

Returns

integer

addChart()

addChart(\Element\Chart  $chart) : integer

Parameters

\Element\Chart $chart

Returns

integer

addComment()

addComment(\Element\Comment  $comment) : integer

Parameters

\Element\Comment $comment

Returns

integer

addParagraphStyle()

addParagraphStyle(string  $styleName, mixed  $styles) : \PhpOffice\PhpWord\Style\Paragraph

Parameters

string $styleName
mixed $styles

Returns

\PhpOffice\PhpWord\Style\Paragraph

addFontStyle()

addFontStyle(string  $styleName, mixed  $fontStyle, mixed  $paragraphStyle = null) : \PhpOffice\PhpWord\Style\Font

Parameters

string $styleName
mixed $fontStyle
mixed $paragraphStyle

Returns

\PhpOffice\PhpWord\Style\Font

addLinkStyle()

addLinkStyle(string  $styleName, mixed  $styles) : \PhpOffice\PhpWord\Style\Font

Parameters

string $styleName
mixed $styles

Returns

\PhpOffice\PhpWord\Style\Font

addTitleStyle()

addTitleStyle(mixed  $depth, mixed  $fontStyle, mixed  $paragraphStyle = null) : \PhpOffice\PhpWord\Style\Font

Parameters

mixed $depth
mixed $fontStyle
mixed $paragraphStyle

Returns

\PhpOffice\PhpWord\Style\Font

addTableStyle()

addTableStyle(string  $styleName, mixed  $styleTable, mixed  $styleFirstRow = null) : \PhpOffice\PhpWord\Style\Table

Parameters

string $styleName
mixed $styleTable
mixed $styleFirstRow

Returns

\PhpOffice\PhpWord\Style\Table

addNumberingStyle()

addNumberingStyle(string  $styleName, mixed  $styles) : \PhpOffice\PhpWord\Style\Numbering

Parameters

string $styleName
mixed $styles

Returns

\PhpOffice\PhpWord\Style\Numbering