Documentation

Content extends AbstractPart
in package

ODText content part writer: content.xml.

Tags
SuppressWarnings

("PHPMD.CouplingBetweenObjects")

Table of Contents

Properties

$dateFormat  : string
$objects  : array<string|int, AbstractElement>
$parentWriter  : AbstractWriter
Parent writer.
$autoStyles  : array<string|int, mixed>
Auto style collection.
$imageParagraphStyles  : mixed

Methods

addObject()  : int
getObjects()  : array<string|int, AbstractElement>
getParentWriter()  : AbstractWriter
Get parent writer.
setObjects()  : self
setParentWriter()  : void
Set parent writer.
write()  : string
Write part.
getXmlWriter()  : XMLWriter
Get XML Writer.
writeCommonRootAttributes()  : void
Write common root attributes.
writeFontFaces()  : void
Write font faces declaration.
writeText()  : bool
Write an XML text, this will call text() or writeRaw() depending on the value of Settings::isOutputEscapingEnabled().
applyTableStyleToCell()  : void
collectFormControls()  : void
Collect form controls from the document containers.
collectTrackedChanges()  : void
Finds all tracked changes.
getAutoStyles()  : void
Get automatic styles.
getContainerStyle()  : void
Get all styles of each elements in container recursively.
getElementStyle()  : void
Get style of individual element.
getElementStyleField()  : void
Get font style of individual field element.
getElementStyleTextRun()  : void
Get style of individual element.
hasCellStyle()  : bool
setCellBorderIfUnset()  : void
writeAutoStyles()  : void
Write automatic styles other than fonts and paragraphs.
writeForms()  : void
Write the document-level form controls referenced by draw:control.
writeTextStyles()  : void
Write automatic styles.

Properties

$dateFormat

protected string $dateFormat = 'Y-m-d\TH:i:s.000'

Date format

$autoStyles

Auto style collection.

private array<string|int, mixed> $autoStyles = ['Section' => [], 'Image' => [], 'Line' => [], 'Table' => [], 'Row' => [], 'Cell' => [], 'Shape' => [], 'TextBox' => []]

Collect inline style information from section, image, and table elements

Tags
todo

Merge font and paragraph styles

$imageParagraphStyles

private mixed $imageParagraphStyles = []

Methods

write()

Write part.

public write() : string
Return values
string

writeCommonRootAttributes()

Write common root attributes.

protected writeCommonRootAttributes(XMLWriter $xmlWriter) : void
Parameters
$xmlWriter : XMLWriter

writeText()

Write an XML text, this will call text() or writeRaw() depending on the value of Settings::isOutputEscapingEnabled().

protected writeText(string $content) : bool
Parameters
$content : string

The text string to write

Return values
bool

Returns true on success or false on failure

applyTableStyleToCell()

private applyTableStyleToCell(Cell $cell, Table $tableStyle, int $rowIndex, int $cellIndex, int $rowCount, int $cellCount) : void
Parameters
$cell : Cell
$tableStyle : Table
$rowIndex : int
$cellIndex : int
$rowCount : int
$cellCount : int

getAutoStyles()

Get automatic styles.

private getAutoStyles(PhpWord $phpWord) : void
Parameters
$phpWord : PhpWord

getContainerStyle()

Get all styles of each elements in container recursively.

private getContainerStyle(AbstractContainer $container, int &$paragraphStyleCount, int &$fontStyleCount) : void

Table style can be null or string of the style name

Parameters
$container : AbstractContainer
$paragraphStyleCount : int
$fontStyleCount : int
Tags
todo

Simplify the logic

getElementStyle()

Get style of individual element.

private getElementStyle(Text $element, int &$paragraphStyleCount, int &$fontStyleCount) : void
Parameters
$element : Text
$paragraphStyleCount : int
$fontStyleCount : int

getElementStyleField()

Get font style of individual field element.

private getElementStyleField(Field $element, int &$fontStyleCount) : void
Parameters
$element : Field
$fontStyleCount : int

getElementStyleTextRun()

Get style of individual element.

private getElementStyleTextRun(TextRun $element, int &$paragraphStyleCount) : void
Parameters
$element : TextRun
$paragraphStyleCount : int

hasCellStyle()

private hasCellStyle(Cell $cell) : bool
Parameters
$cell : Cell
Return values
bool

setCellBorderIfUnset()

private setCellBorderIfUnset(Cell $style, string $side, null|float|int $size, string|null $color) : void
Parameters
$style : Cell
$side : string
$size : null|float|int
$color : string|null

writeAutoStyles()

Write automatic styles other than fonts and paragraphs.

private writeAutoStyles(XMLWriter $xmlWriter) : void
Parameters
$xmlWriter : XMLWriter
Tags
since
0.11.0

writeTextStyles()

Write automatic styles.

private writeTextStyles(XMLWriter $xmlWriter) : void
Parameters
$xmlWriter : XMLWriter
On this page

Search results