Footer extends AbstractContainer
Footer element
Table of Contents
- AUTO = 'default'
- Header/footer types constants
- EVEN = 'even'
- FIRST = 'first'
- $collectionRelation : bool
- Is part of collection; true for Title, Footnote, Endnote, Chart, and Comment
- $commentRangeEnd : Comment
- The end position for the linked comment
- $commentRangeStart : Comment
- The start position for the linked comment
- $container : string
- Container type Section|Header|Footer|Footnote|Endnote|Cell|TextRun|TextBox|ListItemRun|TrackChange
- $docPart : string
- Document part type: Section|Header|Footer|Footnote|Endnote
- $docPartId : int
- Document part Id
- $elementId : string
- Unique Id for element
- $elementIndex : int
- Index of element in the elements collection (start with 1)
- $elements : array<string|int, AbstractElement>
- Elements collection
- $mediaRelation : bool
- Has media relation flag; true for Link, Image, and Object
- $phpWord : PhpWord
- PhpWord object
- $relationId : int
- Relation Id
- $sectionId : int
- Section Id
- $type : string
- Header type
- $nestedLevel : int
- Depth of table container nested level; Primarily used for RTF writer/reader
- $parent : AbstractElement|null
- A reference to the parent
- $parentContainer : string
- Parent container type
- $trackChange : TrackChange
- changed element info
- __call() : AbstractElement
- Magic method to catch all 'addElement' variation
- __construct() : mixed
- Create new instance
- addBookmark() :
- addChart() :
- addCheckBox() :
- addEndnote() :
- addField() :
- addFootnote() :
- addFormField() :
- addImage() :
- addLine() :
- addLink() :
- addListItem() :
- addListItemRun() :
- addObject() :
- addOLEObject() :
- addPageBreak() :
- addPreserveText() :
- addSDT() :
- addShape() :
- addTable() :
- addText() :
- addTextBox() :
- addTextBreak() :
- addTextRun() :
- addTitle() :
- addTOC() :
- countElements() : int
- Count elements
- createFootnote() : Footnote
- Create footnote element
- createTextRun() : TextRun
- Create textrun element
- evenPage() : string
- Even numbered pages only
- firstPage() : string
- First page only header
- getCommentRangeEnd() : Comment
- Get comment end
- getCommentRangeStart() : Comment
- Get comment start
- getDocPart() : string
- Get doc part
- getDocPartId() : int
- Get doc part Id
- getElement() : AbstractElement|null
- Returns the element at the requested position
- getElementId() : string
- Get element unique ID
- getElementIndex() : int
- Get element index
- getElements() : array<string|int, AbstractElement>
- Get all elements
- getNestedLevel() : int
- Get nested level
- getParent() : AbstractElement|null
- Get parent element
- getPhpWord() : PhpWord
- Get PhpWord
- getRelationId() : int
- Get relation Id
- getSectionId() : int
- Get section number
- getTrackChange() : TrackChange
- Gets the trackChange information
- getType() : string
- Get type
- isInSection() : bool
- Check if element is located in Section doc part (as opposed to Header/Footer)
- removeElement() : mixed
- Removes the element at requested index
- resetType() : string
- Reset type to default
- setChangeInfo() : mixed
- Set changed
- setCommentRangeEnd() : mixed
- Set comment end
- setCommentRangeStart() : mixed
- Set comment start
- setDocPart() : mixed
- Set doc part.
- setElementId() : mixed
- Set element unique ID from 6 first digit of md5.
- setElementIndex() : mixed
- Set element index.
- setParentContainer() : mixed
- Set parent container
- setPhpWord() : mixed
- Set PhpWord as reference.
- setRelationId() : mixed
- Set relation Id.
- setTrackChange() : mixed
- Sets the trackChange information
- setType() : mixed
- Set type.
- addElement() : AbstractElement
- Add element
- setEnumVal() : string|null
- Set enum value
- setNewStyle() : mixed
- Set new style value
- checkValidity() : bool
- Check if a method is allowed for the current container
- getMediaPart() : string
- Return media element (image, object, link) container name
- setCollectionRelation() : mixed
- Set relation Id for elements that will be registered in the Collection subnamespaces.
- setMediaRelation() : mixed
- Set relation Id for media elements (link, image, object; legacy of OOXML)
Constants
AUTO
Header/footer types constants
public
string
AUTO
= 'default'
Tags
EVEN
public
mixed
EVEN
= 'even'
FIRST
public
mixed
FIRST
= 'first'
Properties
$collectionRelation
Is part of collection; true for Title, Footnote, Endnote, Chart, and Comment
protected
bool
$collectionRelation
= false
$commentRangeEnd
The end position for the linked comment
protected
Comment
$commentRangeEnd
$commentRangeStart
The start position for the linked comment
protected
Comment
$commentRangeStart
$container
Container type Section|Header|Footer|Footnote|Endnote|Cell|TextRun|TextBox|ListItemRun|TrackChange
protected
string
$container
= 'Footer'
$docPart
Document part type: Section|Header|Footer|Footnote|Endnote
protected
string
$docPart
= 'Section'
Used by textrun and cell container to determine where the element is located because it will affect the availability of other element, e.g. footnote will not be available when $docPart is header or footer.
$docPartId
Document part Id
protected
int
$docPartId
= 1
For header and footer, this will be = ($sectionId - 1) * 3 + $index because the max number of header/footer in every page is 3, i.e. AUTO, FIRST, and EVEN (AUTO = ODD)
$elementId
Unique Id for element
protected
string
$elementId
$elementIndex
Index of element in the elements collection (start with 1)
protected
int
$elementIndex
= 1
$elements
Elements collection
protected
array<string|int, AbstractElement>
$elements
= array()
$mediaRelation
Has media relation flag; true for Link, Image, and Object
protected
bool
$mediaRelation
= false
$phpWord
PhpWord object
protected
PhpWord
$phpWord
$relationId
Relation Id
protected
int
$relationId
$sectionId
Section Id
protected
int
$sectionId
$type
Header type
protected
string
$type
= self::AUTO
$nestedLevel
Depth of table container nested level; Primarily used for RTF writer/reader
private
int
$nestedLevel
= 0
0 = Not in a table; 1 = in a table; 2 = in a table inside another table, etc.
$parent
A reference to the parent
private
AbstractElement|null
$parent
$parentContainer
Parent container type
private
string
$parentContainer
$trackChange
changed element info
private
TrackChange
$trackChange
Methods
__call()
Magic method to catch all 'addElement' variation
public
__call(mixed $function, mixed $args) : AbstractElement
This removes addText, addTextRun, etc. When adding new element, we have to
add the model in the class docblock with @method.
Warning: This makes capitalization matters, e.g. addCheckbox or addcheckbox won't work.
Parameters
- $function : mixed
- $args : mixed
Return values
AbstractElement —__construct()
Create new instance
public
__construct(int $sectionId[, int $containerId = 1 ][, string $type = self::AUTO ]) : mixed
Parameters
- $sectionId : int
- $containerId : int = 1
- $type : string = self::AUTO
Return values
mixed —addBookmark()
public
addBookmark(string $name) :
Parameters
- $name : string
Return values
—addChart()
public
addChart(string $type, array<string|int, mixed> $categories, array<string|int, mixed> $values, array<string|int, mixed> $style = null, mixed $seriesName) :
Parameters
- $type : string
- $categories : array<string|int, mixed>
- $values : array<string|int, mixed>
- $style = null : array<string|int, mixed>
- $seriesName : mixed
Return values
—addCheckBox()
public
addCheckBox(string $name, mixed $text, mixed $fStyle = null, mixed $pStyle = null) :
Parameters
- $name : string
- $text : mixed
- $fStyle = null : mixed
- $pStyle = null : mixed
Return values
—addEndnote()
public
addEndnote(mixed $pStyle = null) :
Parameters
- $pStyle = null : mixed
Return values
—addField()
public
addField(string $type = null, array<string|int, mixed> $properties = array() :
, array $options = array(), mixed $text = null)
Parameters
- $type = null : string
- $properties = array( : array<string|int, mixed>
Return values
—addFootnote()
public
addFootnote(mixed $pStyle = null) :
Parameters
- $pStyle = null : mixed
Return values
—addFormField()
public
addFormField(string $type, mixed $fStyle = null, mixed $pStyle = null) :
Parameters
- $type : string
- $fStyle = null : mixed
- $pStyle = null : mixed
Return values
—addImage()
public
addImage(string $source, mixed $style = null, bool $isWatermark = false, mixed $name) :
Parameters
- $source : string
- $style = null : mixed
- $isWatermark = false : bool
- $name : mixed
Return values
—addLine()
public
addLine(mixed $lineStyle = null) :
Parameters
- $lineStyle = null : mixed
Return values
—addLink()
public
addLink(string $target, string $text = null, mixed $fStyle = null, mixed $pStyle = null, bool $internal = false) :
Parameters
- $target : string
- $text = null : string
- $fStyle = null : mixed
- $pStyle = null : mixed
- $internal = false : bool
Return values
—addListItem()
public
addListItem(string $txt, int $depth = 0, mixed $font = null, mixed $list = null, mixed $para = null) :
Parameters
- $txt : string
- $depth = 0 : int
- $font = null : mixed
- $list = null : mixed
- $para = null : mixed
Return values
—addListItemRun()
public
addListItemRun(int $depth = 0, mixed $listStyle = null, mixed $pStyle = null) :
Parameters
- $depth = 0 : int
- $listStyle = null : mixed
- $pStyle = null : mixed
Return values
—addObject()
public
addObject(string $source, mixed $style = null) :
deprecated, use addOLEObject instead
Parameters
- $source : string
- $style = null : mixed
Return values
—addOLEObject()
public
addOLEObject(string $source, mixed $style = null) :
Parameters
- $source : string
- $style = null : mixed
Return values
—addPageBreak()
public
addPageBreak() :
Return values
—addPreserveText()
public
addPreserveText(string $text, mixed $fStyle = null, mixed $pStyle = null) :
Parameters
- $text : string
- $fStyle = null : mixed
- $pStyle = null : mixed
Return values
—addSDT()
public
addSDT(string $type) :
Parameters
- $type : string
Return values
—addShape()
public
addShape(string $type, mixed $style = null) :
Parameters
- $type : string
- $style = null : mixed
Return values
—addTable()
public
addTable(mixed $style = null) :
Parameters
- $style = null : mixed
Return values
—addText()
public
addText(string $text, mixed $fStyle = null, mixed $pStyle = null) :
Parameters
- $text : string
- $fStyle = null : mixed
- $pStyle = null : mixed
Return values
—addTextBox()
public
addTextBox(mixed $style = null) :
Parameters
- $style = null : mixed
Return values
—addTextBreak()
public
addTextBreak(int $count = 1, mixed $fStyle = null, mixed $pStyle = null) :
Parameters
- $count = 1 : int
- $fStyle = null : mixed
- $pStyle = null : mixed
Return values
—addTextRun()
public
addTextRun(mixed $pStyle = null) :
Parameters
- $pStyle = null : mixed
Return values
—addTitle()
public
addTitle(mixed $text, int $depth = 1) :
Parameters
- $text : mixed
- $depth = 1 : int
Return values
—addTOC()
public
addTOC(mixed $fontStyle = null, mixed $tocStyle = null, int $minDepth = 1, int $maxDepth = 9) :
Parameters
- $fontStyle = null : mixed
- $tocStyle = null : mixed
- $minDepth = 1 : int
- $maxDepth = 9 : int
Return values
—countElements()
Count elements
public
countElements() : int
Return values
int —createFootnote()
Create footnote element
public
createFootnote([mixed $paragraphStyle = null ]) : Footnote
Parameters
- $paragraphStyle : mixed = null
Tags
Return values
Footnote —createTextRun()
Create textrun element
public
createTextRun([mixed $paragraphStyle = null ]) : TextRun
Parameters
- $paragraphStyle : mixed = null
Tags
Return values
TextRun —evenPage()
Even numbered pages only
public
evenPage() : string
Return values
string —firstPage()
First page only header
public
firstPage() : string
Return values
string —getCommentRangeEnd()
Get comment end
public
getCommentRangeEnd() : Comment
Return values
Comment —getCommentRangeStart()
Get comment start
public
getCommentRangeStart() : Comment
Return values
Comment —getDocPart()
Get doc part
public
getDocPart() : string
Return values
string —getDocPartId()
Get doc part Id
public
getDocPartId() : int
Return values
int —getElement()
Returns the element at the requested position
public
getElement(int $index) : AbstractElement|null
Parameters
- $index : int
Return values
AbstractElement|null —getElementId()
Get element unique ID
public
getElementId() : string
Return values
string —getElementIndex()
Get element index
public
getElementIndex() : int
Return values
int —getElements()
Get all elements
public
getElements() : array<string|int, AbstractElement>
Return values
array<string|int, AbstractElement> —getNestedLevel()
Get nested level
public
getNestedLevel() : int
Return values
int —getParent()
Get parent element
public
getParent() : AbstractElement|null
Return values
AbstractElement|null —getPhpWord()
Get PhpWord
public
getPhpWord() : PhpWord
Return values
PhpWord —getRelationId()
Get relation Id
public
getRelationId() : int
Return values
int —getSectionId()
Get section number
public
getSectionId() : int
Return values
int —getTrackChange()
Gets the trackChange information
public
getTrackChange() : TrackChange
Return values
TrackChange —getType()
Get type
public
getType() : string
Tags
Return values
string —isInSection()
Check if element is located in Section doc part (as opposed to Header/Footer)
public
isInSection() : bool
Return values
bool —removeElement()
Removes the element at requested index
public
removeElement(int|AbstractElement $toRemove) : mixed
Parameters
- $toRemove : int|AbstractElement
Return values
mixed —resetType()
Reset type to default
public
resetType() : string
Return values
string —setChangeInfo()
Set changed
public
setChangeInfo(string $type, string $author[, null|int|DateTime $date = null ]) : mixed
Parameters
- $type : string
-
INSERTED|DELETED
- $author : string
- $date : null|int|DateTime = null
-
allways in UTC
Return values
mixed —setCommentRangeEnd()
Set comment end
public
setCommentRangeEnd(Comment $value) : mixed
Parameters
- $value : Comment
Return values
mixed —setCommentRangeStart()
Set comment start
public
setCommentRangeStart(Comment $value) : mixed
Parameters
- $value : Comment
Return values
mixed —setDocPart()
Set doc part.
public
setDocPart(string $docPart[, int $docPartId = 1 ]) : mixed
Parameters
- $docPart : string
- $docPartId : int = 1
Return values
mixed —setElementId()
Set element unique ID from 6 first digit of md5.
public
setElementId() : mixed
Return values
mixed —setElementIndex()
Set element index.
public
setElementIndex(int $value) : mixed
Parameters
- $value : int
Return values
mixed —setParentContainer()
Set parent container
public
setParentContainer(AbstractElement $container) : mixed
Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
Parameters
- $container : AbstractElement
Return values
mixed —setPhpWord()
Set PhpWord as reference.
public
setPhpWord([PhpWord $phpWord = null ]) : mixed
Parameters
- $phpWord : PhpWord = null
Return values
mixed —setRelationId()
Set relation Id.
public
setRelationId(int $value) : mixed
Parameters
- $value : int
Return values
mixed —setTrackChange()
Sets the trackChange information
public
setTrackChange(TrackChange $trackChange) : mixed
Parameters
- $trackChange : TrackChange
Return values
mixed —setType()
Set type.
public
setType([string $value = self::AUTO ]) : mixed
Parameters
- $value : string = self::AUTO
Tags
Return values
mixed —addElement()
Add element
protected
addElement(string $elementName) : AbstractElement
Each element has different number of parameters passed
Parameters
- $elementName : string
Return values
AbstractElement —setEnumVal()
Set enum value
protected
setEnumVal([string|null $value = null ][, array<string|int, string> $enum = array() ][, string|null $default = null ]) : string|null
Parameters
- $value : string|null = null
- $enum : array<string|int, string> = array()
- $default : string|null = null
Tags
Return values
string|null —setNewStyle()
Set new style value
protected
setNewStyle(mixed $styleObject[, mixed $styleValue = null ][, bool $returnObject = false ]) : mixed
Parameters
- $styleObject : mixed
-
Style object
- $styleValue : mixed = null
-
Style value
- $returnObject : bool = false
-
Always return object
Return values
mixed —checkValidity()
Check if a method is allowed for the current container
private
checkValidity(string $method) : bool
Parameters
- $method : string
Tags
Return values
bool —getMediaPart()
Return media element (image, object, link) container name
private
getMediaPart() : string
Return values
string —section|headerx|footerx|footnote|endnote
setCollectionRelation()
Set relation Id for elements that will be registered in the Collection subnamespaces.
private
setCollectionRelation() : mixed
Return values
mixed —setMediaRelation()
Set relation Id for media elements (link, image, object; legacy of OOXML)
private
setMediaRelation() : mixed
- Image element needs to be passed to Media object
- Icon needs to be set for Object element