PhpWord
PHPWord main class
Table of Contents
- DEFAULT_FONT_COLOR = PhpOfficePhpWordSettings::DEFAULT_FONT_COLOR
- DEFAULT_FONT_CONTENT_TYPE = PhpOfficePhpWordSettings::DEFAULT_FONT_CONTENT_TYPE
- DEFAULT_FONT_NAME = PhpOfficePhpWordSettings::DEFAULT_FONT_NAME
- Default font settings
- DEFAULT_FONT_SIZE = PhpOfficePhpWordSettings::DEFAULT_FONT_SIZE
- $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() :
- createSection() : Section
- Create new section
- getCharts() :
- getComments() :
- 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() :
- getFootnotes() :
- getProtection() : Protection
- Get protection
- getSection() : Section|null
- Returns the section at the requested position
- getSections() : array<string|int, Section>
- Get all sections
- getSettings() : Settings
- Get compatibility
- getTitles() :
- loadTemplate() : TemplateProcessor
- Load template by filename
- save() : bool
- Save to file or download
- setDefaultFontName() : mixed
- Set default font name.
- setDefaultFontSize() : mixed
- Set default font size.
- setDefaultParagraphStyle() : Paragraph
- Set default paragraph style definition to styles.xml
- setDocumentProperties() : self
- Set document properties object
- sortSections() : mixed
- Sorts the sections using the callable passed
Constants
DEFAULT_FONT_COLOR
public
mixed
DEFAULT_FONT_COLOR
= PhpOfficePhpWordSettings::DEFAULT_FONT_COLOR
Tags
DEFAULT_FONT_CONTENT_TYPE
public
mixed
DEFAULT_FONT_CONTENT_TYPE
= PhpOfficePhpWordSettings::DEFAULT_FONT_CONTENT_TYPE
Tags
DEFAULT_FONT_NAME
Default font settings
public
mixed
DEFAULT_FONT_NAME
= PhpOfficePhpWordSettings::DEFAULT_FONT_NAME
Tags
DEFAULT_FONT_SIZE
public
mixed
DEFAULT_FONT_SIZE
= PhpOfficePhpWordSettings::DEFAULT_FONT_SIZE
Tags
Properties
$collections
Collections
private
array<string|int, mixed>
$collections
= array()
$metadata
Metadata
private
array<string|int, mixed>
$metadata
= array()
Tags
$sections
Collection of sections
private
array<string|int, Section>
$sections
= array()
Methods
__call()
Dynamic function call to reduce static dependency
public
__call(mixed $function, mixed $args) : mixed
Parameters
- $function : mixed
- $args : mixed
Tags
Return values
mixed —__construct()
Create new instance
public
__construct() : mixed
Collections are created dynamically
Return values
mixed —addBookmark()
public
addBookmark(Bookmark $bookmark) :
Parameters
- $bookmark : Bookmark
Return values
—addChart()
public
addChart(Chart $chart) :
Parameters
- $chart : Chart
Return values
—addComment()
public
addComment(Comment $comment) :
Parameters
- $comment : Comment
Return values
—addEndnote()
public
addEndnote(Endnote $endnote) :
Parameters
- $endnote : Endnote
Return values
—addFontStyle()
public
addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null) :
Parameters
- $styleName : string
- $fontStyle : mixed
- $paragraphStyle = null : mixed
Return values
—addFootnote()
public
addFootnote(Footnote $footnote) :
Parameters
- $footnote : Footnote
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
—createSection()
Create new section
public
createSection([array<string|int, mixed> $settings = null ]) : Section
Parameters
- $settings : array<string|int, mixed> = null
Tags
Return values
Section —getCharts()
public
getCharts() :
Return values
—getComments()
public
getComments() :
Return values
—getCompatibility()
Get compatibility
public
getCompatibility() : Compatibility
Tags
Return values
Compatibility —getDefaultFontName()
Get default font name
public
getDefaultFontName() : string
Return values
string —getDefaultFontSize()
Get default font size
public
getDefaultFontSize() : int
Return values
int —getDocInfo()
Get document properties object
public
getDocInfo() : DocInfo
Return values
DocInfo —getDocumentProperties()
Get document properties object
public
getDocumentProperties() : DocInfo
Tags
Return values
DocInfo —getEndnotes()
public
getEndnotes() :
Return values
—getFootnotes()
public
getFootnotes() :
Return values
—getProtection()
Get protection
public
getProtection() : Protection
Tags
Return values
Protection —getSection()
Returns the section at the requested position
public
getSection(int $index) : Section|null
Parameters
- $index : int
Return values
Section|null —getSections()
Get all sections
public
getSections() : array<string|int, Section>
Return values
array<string|int, Section> —getSettings()
Get compatibility
public
getSettings() : Settings
Tags
Return values
Settings —getTitles()
public
getTitles() :
Return values
—loadTemplate()
Load template by filename
public
loadTemplate(string $filename) : TemplateProcessor
Parameters
- $filename : string
-
Fully qualified filename
Tags
Return values
TemplateProcessor —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) : mixed
Parameters
- $fontName : string
Return values
mixed —setDefaultFontSize()
Set default font size.
public
setDefaultFontSize(int $fontSize) : mixed
Parameters
- $fontSize : int
Return values
mixed —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
Return values
self —sortSections()
Sorts the sections using the callable passed
public
sortSections(callable $sorter) : mixed
Parameters
- $sorter : callable