Properties

$listIndex

$listIndex : 

Type

$xpath

$xpath : 

Type

$options

$options : 

Type

Methods

addHtml()

addHtml(\PhpOffice\PhpWord\Element\AbstractContainer  $element, string  $html, boolean  $fullHTML = false, boolean  $preserveWhiteSpace = true,   $options = null) 

Add HTML parts.

Note: $stylesheet parameter is removed to avoid PHPMD error for unused parameter Warning: Do not pass user-generated HTML here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing local file paths or URLs in .

Parameters

\PhpOffice\PhpWord\Element\AbstractContainer $element

Where the parts need to be added

string $html

The code to parse

boolean $fullHTML

If it's a full HTML, no need to add 'body' tag

boolean $preserveWhiteSpace

If false, the whitespaces between nodes will be removed

$options

parseInlineStyle()

parseInlineStyle(\DOMNode  $node, array  $styles = array()) : array

parse Inline style of a node

Parameters

\DOMNode $node

Node to check on attributes and to compile a style array

array $styles

is supplied, the inline style attributes are added to the already existing style

Returns

array

parseNode()

parseNode(\DOMNode  $node, \PhpOffice\PhpWord\Element\AbstractContainer  $element, array  $styles = array(), array  $data = array()) 

Parse a node and add a corresponding element to the parent element.

Parameters

\DOMNode $node

node to parse

\PhpOffice\PhpWord\Element\AbstractContainer $element

object to add an element corresponding with the node

array $styles

Array with all styles

array $data

Array to transport data to a next level in the DOM tree, for example level of listitems

parseChildNodes()

parseChildNodes(\DOMNode  $node, \PhpOffice\PhpWord\Element\AbstractContainer  $element, array  $styles, array  $data) 

Parse child nodes.

Parameters

\DOMNode $node
\PhpOffice\PhpWord\Element\AbstractContainer $element
array $styles
array $data

parseProperty()

parseProperty(  $styles, string  $argument1, string  $argument2) 

Parse property node

Parameters

$styles
string $argument1

Style name

string $argument2

Style value

parseSpan()

parseSpan(\DOMNode  $node,   $styles) 

Parse span node

Parameters

\DOMNode $node
$styles

shouldAddTextRun()

shouldAddTextRun(\DOMNode  $node) : boolean

Checks if $node contains an HTML element that cannot be added to TextRun

Parameters

\DOMNode $node

Returns

boolean —

Returns true if the node contains an HTML element that cannot be added to TextRun

recursiveParseStylesInHierarchy()

recursiveParseStylesInHierarchy(\DOMNode  $node, array  $style) 

Recursively parses styles on parent nodes TODO if too slow, add caching of parent nodes, !! everything is static here so watch out for concurrency !!

Parameters

\DOMNode $node
array $style

parseList()

parseList(\DOMNode  $node, \PhpOffice\PhpWord\Element\AbstractContainer  $element,   $styles,   $data) 

Parse list node

Parameters

\DOMNode $node
\PhpOffice\PhpWord\Element\AbstractContainer $element
$styles
$data

getListStyle()

getListStyle(boolean  $isOrderedList) : array

Parameters

boolean $isOrderedList

Returns

array

parseListItem()

parseListItem(\DOMNode  $node, \PhpOffice\PhpWord\Element\AbstractContainer  $element,   $styles, array  $data) 

Parse list item node

Parameters

\DOMNode $node
\PhpOffice\PhpWord\Element\AbstractContainer $element
$styles
array $data

parseStyle()

parseStyle(\DOMAttr  $attribute, array  $styles) : array

Parse style

Parameters

\DOMAttr $attribute
array $styles

Returns

array

mapBorderStyle()

mapBorderStyle(string  $cssBorderStyle) : null|string

Transforms a CSS border style into a word border style

Parameters

string $cssBorderStyle

Returns

null|string

mapAlign()

mapAlign(string  $cssAlignment) : string|null

Transforms a HTML/CSS alignment into a \PhpOffice\PhpWord\SimpleType\Jc

Parameters

string $cssAlignment

Returns

string|null