Documentation

PhpWord

PHPWord main class.

Table of Contents

$collections  : array<string|int, mixed>
Collections.
$metadata  : array<string|int, mixed>
Metadata.
$sections  : array<string|int, Section>
Collection of sections.
__call()  : mixed
Dynamic function call to reduce static dependency.
__construct()  : mixed
Create new instance.
addBookmark()  :
addChart()  :
addComment()  :
addEndnote()  :
addFontStyle()  :
addFootnote()  :
addLinkStyle()  :
addNumberingStyle()  :
addParagraphStyle()  :
addSection()  : Section
Create new section.
addTableStyle()  :
addTitle()  :
addTitleStyle()  :
getCharts()  :
getComments()  :
getCompatibility()  : Compatibility
Get compatibility.
getDefaultFontName()  : string
Get default font name.
getDefaultFontSize()  : int
Get default font size.
getDocInfo()  : DocInfo
Get document properties object.
getEndnotes()  :
getFootnotes()  :
getSection()  : null|Section
Returns the section at the requested position.
getSections()  : array<string|int, Section>
Get all sections.
getSettings()  : Settings
Get compatibility.
getTitles()  :
save()  : bool
Save to file or download.
setDefaultFontName()  : void
Set default font name.
setDefaultFontSize()  : void
Set default font size.
setDefaultParagraphStyle()  : Paragraph
Set default paragraph style definition to styles.xml.
sortSections()  : void
Sorts the sections using the callable passed.

Properties

$collections

Collections.

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

$metadata

Metadata.

private array<string|int, mixed> $metadata = []
Tags
since
0.12.0

$sections

Collection of sections.

private array<string|int, Section> $sections = []

Methods

__call()

Dynamic function call to reduce static dependency.

public __call(mixed $function, mixed $args) : mixed
Parameters
$function : mixed
$args : mixed
Tags
since
0.12.0
Return values
mixed

__construct()

Create new instance.

public __construct() : mixed

Collections are created dynamically

Return values
mixed

addChart()

public addChart(Chart $chart) :
Parameters
$chart : Chart
Return values

addFontStyle()

public addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null) :
Parameters
$styleName : string
$fontStyle : mixed
$paragraphStyle = null : mixed
Return values

addLinkStyle()

public addLinkStyle(string $styleName, mixed $styles) :
Parameters
$styleName : string
$styles : mixed
Return values

addNumberingStyle()

public addNumberingStyle(string $styleName, mixed $styles) :
Parameters
$styleName : string
$styles : mixed
Return values

addParagraphStyle()

public addParagraphStyle(string $styleName, mixed $styles) :
Parameters
$styleName : string
$styles : mixed
Return values

addSection()

Create new section.

public addSection([array<string|int, mixed> $style = null ]) : Section
Parameters
$style : array<string|int, mixed> = null
Return values
Section

addTableStyle()

public addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null) :
Parameters
$styleName : string
$styleTable : mixed
$styleFirstRow = null : mixed
Return values

addTitle()

public addTitle(Title $title) :
Parameters
$title : Title
Return values

addTitleStyle()

public addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null) :
Parameters
$depth : mixed
$fontStyle : mixed
$paragraphStyle = null : mixed
Return values

getCharts()

public getCharts() :
Return values

getComments()

public getComments() :
Return values

getDefaultFontName()

Get default font name.

public getDefaultFontName() : string
Return values
string

getDefaultFontSize()

Get default font size.

public getDefaultFontSize() : int
Return values
int

getEndnotes()

public getEndnotes() :
Return values

getFootnotes()

public getFootnotes() :
Return values

getSection()

Returns the section at the requested position.

public getSection(int $index) : null|Section
Parameters
$index : int
Return values
null|Section

getSections()

Get all sections.

public getSections() : array<string|int, Section>
Return values
array<string|int, Section>

getTitles()

public getTitles() :
Return values

save()

Save to file or download.

public save(string $filename[, string $format = 'Word2007' ][, bool $download = false ]) : bool

All exceptions should already been handled by the writers

Parameters
$filename : string
$format : string = 'Word2007'
$download : bool = false
Return values
bool

setDefaultFontName()

Set default font name.

public setDefaultFontName(string $fontName) : void
Parameters
$fontName : string
Return values
void

setDefaultFontSize()

Set default font size.

public setDefaultFontSize(int $fontSize) : void
Parameters
$fontSize : int
Return values
void

setDefaultParagraphStyle()

Set default paragraph style definition to styles.xml.

public setDefaultParagraphStyle(array<string|int, mixed> $styles) : Paragraph
Parameters
$styles : array<string|int, mixed>

Paragraph style definition

Return values
Paragraph

Search results