Documentation

PhpWord
in package

PHPWord main class.

Table of Contents

Properties

$collections  : array<string|int, mixed>
Collections.
$metadata  : array<string|int, mixed>
Metadata.
$sections  : array<string|int, Section>
Collection of sections.

Methods

__call()  : mixed
Dynamic function call to reduce static dependency.
__construct()  : mixed
Create new instance.
addBookmark()  : int
addChart()  : int
addComment()  : int
addEndnote()  : int
addFontStyle()  : Font
addFootnote()  : int
addLinkStyle()  : Font
addNumberingStyle()  : Numbering
addParagraphStyle()  : Paragraph
addSection()  : Section
Create new section.
addTableStyle()  : Table
addTitle()  : int
addTitleStyle()  : Font
createSection()  : Section
Create new section.
getCharts()  : Charts
getComments()  : Comments
getCompatibility()  : Compatibility
Get compatibility.
getDefaultFontName()  : string
Get default font name.
getDefaultFontSize()  : int
Get default font size.
getDocInfo()  : DocInfo
Get document properties object.
getDocumentProperties()  : DocInfo
Get document properties object.
getEndnotes()  : Endnotes
getFootnotes()  : Footnotes
getSection()  : null|Section
Returns the section at the requested position.
getSections()  : array<string|int, Section>
Get all sections.
getSettings()  : Settings
Get compatibility.
getTitles()  : Titles
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.
setDocumentProperties()  : self
Set document properties object.
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

__construct()

Create new instance.

public __construct() : mixed

Collections are created dynamically

addChart()

public addChart([Chart $chart = ]) : int
Parameters
$chart : Chart =
Return values
int

addComment()

public addComment([Comment $comment = ]) : int
Parameters
$comment : Comment =
Return values
int

addEndnote()

public addEndnote([Endnote $endnote = ]) : int
Parameters
$endnote : Endnote =
Return values
int

addFontStyle()

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

addLinkStyle()

public addLinkStyle([string $styleName = ][, mixed $styles = ]) : Font
Parameters
$styleName : string =
$styles : mixed =
Return values
Font

addNumberingStyle()

public addNumberingStyle([string $styleName = ][, mixed $styles = ]) : Numbering
Parameters
$styleName : string =
$styles : mixed =
Return values
Numbering

addParagraphStyle()

public addParagraphStyle([string $styleName = ][, mixed $styles = ]) : Paragraph
Parameters
$styleName : string =
$styles : mixed =
Return values
Paragraph

addSection()

Create new section.

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

addTableStyle()

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

addTitle()

public addTitle([Title $title = ]) : int
Parameters
$title : Title =
Return values
int

addTitleStyle()

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

createSection()

Create new section.

public createSection([array<string|int, mixed> $settings = null ]) : Section
Parameters
$settings : array<string|int, mixed> = null
Tags
codeCoverageIgnore
Return values
Section

getDefaultFontName()

Get default font name.

public getDefaultFontName() : string
Return values
string

getDefaultFontSize()

Get default font size.

public getDefaultFontSize() : int
Return values
int

getDocumentProperties()

Get document properties object.

public getDocumentProperties() : DocInfo
Tags
codeCoverageIgnore
Return values
DocInfo

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>

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

setDefaultFontSize()

Set default font size.

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

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

setDocumentProperties()

Set document properties object.

public setDocumentProperties(DocInfo $documentProperties) : self
Parameters
$documentProperties : DocInfo
Tags
codeCoverageIgnore
Return values
self

        
On this page

Search results