DocumentFragment

Extends \Docxpresso\Core\Elements\ODFElement

Creates a document fragment

package

Docxpresso

subpackage

Core

Methods

Construct

__construct(\Docxpresso\Core\Elements\DOMElement $node, \Docxpresso\Core\Elements\ODFElement $parentODFElement = NULL, string $target = 'document') 
inherited
access

public

Arguments

$node

\Docxpresso\Core\Elements\DOMElement

$target

string

Adds an style to list of styles

_addStyle(string $type, mixed $style, string $styleId, string $target) : array
inherited
access

private

Arguments

$type

string

$style

mixed

$styleId

string

$target

string

Response

array

manages the page breaks inserted into the document

_break(mixed $style = '') : mixed
inherited
access

private

Arguments

$style

mixed

Response

mixed

generates an internal control element

_drawControl(string $name, string $type, array $options) : \Docxpresso\Core\Elements\ODFElement
inherited
access

protected

Arguments

$name

string

$type

string

$options

array

Response

\Docxpresso\Core\Elements\ODFElement

gets the current chart reference when chaining is not used

_getChart() : mixed
inherited
access

private

Response

mixed

Returns the first ancestor ODF node with the given node name or, if not found, returns the root document element

_gotoODFnode(\Docxpresso\Core\Elements\ODFElement $odfNode, string $name = '') : \Docxpresso\Core\Elements\ODFNode
inherited
access

public

Arguments

$name

string

ODF node name

Response

\Docxpresso\Core\Elements\ODFNode

Recursively inserts items into a list

_insertListItems(\Docxpresso\Core\Elements\ODFElement $element, array $items, string $type) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$items

array

$type

string

Response

\Docxpresso\Core\Elements\ODFElement

Inserts a ODF node

_insertODFNode(\Docxpresso\Core\Elements\DOMNode $newNode, \Docxpresso\Core\Elements\DOMElement $refNode = NULL, string $mode = 'append') : void
inherited
access

public

Arguments

$newNode

\Docxpresso\Core\Elements\DOMNode

the node to insert

$refNode

\Docxpresso\Core\Elements\DOMElement

the node to insert the new node

$mode

string

append, after, before, first

adds a list to the document

_list(string $listId, array $options, boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

private

Arguments

$listId

string

$options

array

$reference

boolean

Response

\Docxpresso\Core\Elements\ODFElement

Inserts a note (footnot or endnote) into a paragraph

_note(string $type, array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

private

Arguments

$type

string

it can be endnote or footnote

$options

array

$reference

boolean

Response

\Docxpresso\Core\Elements\ODFElement

adds a paragraph/heading to the document

_paragraph(array $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

private

Arguments

$options

array

Response

\Docxpresso\Core\Elements\ODFElement

adds plain text to a given paragraph or span of text This method is mainly thought for HTML parsing

_plainText(string $text) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$text

string

Response

\Docxpresso\Core\Elements\ODFElement

Gets the style attribute for different types of nodes

_styleAttribute(\Docxpresso\Core\Elements\DOMNode $node) : string
inherited
access

private

Arguments

$node

\Docxpresso\Core\Elements\DOMNode

Response

string

process a style to be included in the styles array

_styleProcessing(string $type, string $defaultStyle, array $options, string $styleId, string $target = 'document') : void
inherited
access

protected

Arguments

$type

string

$defaultStyle

string

$options

array

$styleId

string

$target

string

process a style to be includeed in the styles array

_themeStyles(string $type, string $defaultStyle, array $options) : string
inherited
access

protected

Arguments

$type

string

$defaultStyle

string

$options

array

Response

string

adds a bookmark If we try to insert directly a bookmark into the document a wrapping paragraph with default styles will be automatically created

bookmark(array $options, boolean $reference = false) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'name' => (string) the bookmark name needed for croos references
 'text' => (string)  the text to insert (can be empty)
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the text element so they can be nested.

Response

\Docxpresso\Core\Elements\ODFElement

adds a submit button to a form within the document

button(array $options, boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name
 'value' => (string) the associated value
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) fro absolutely positioned controls (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

adds a table cell to a table

cell(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'cell-content' => (mixed)  the cell content. It may be a string of
  text or a document fragment.
 'rowspan' => (int) the number of rows that the table cell should
  cover.
 'colspan' => (int) the number of columns that the table cell should
  cover.
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

adds a chart to the document The charts can be inserted inline (default) or floating to the left, center or right

chart(string $type, array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$type

string

the available types are: 2D: column, bar, pie, donut, area, line, scatter, bubble, radar, filled-radar, column-line 3D: 3Dcolumn, 3Dbar, 3Dpie, 3Ddonut, 3Darea, 3Dline, 3Dscatter

$options

array

with the following keys and values

 'data' => (array) it can be an array with different formats:
     pie and donuts charts:
         array( 'category_1' => 3,
                'category_2' => 5,
                'category_3' => 4.3,
               )
     bar, column, area , line, scatter, (filled-)radar
     and column-line charts:
         array( 'series' => array('ser_1', 'ser_2'),
                'category_1' => array(20,40),
                'category_2' => array(30,10),
                'category_3' => array(12.5, 54),
               )
     buble charts
         array( array(2, 5 7),
                array(4.3, 12, 3.5),
                array(6, 3, 5),
               )
 'chart-properties' => (array) with keys and values:
     'data-label-number' => (string) none, value or percentage.
     'label-position' => (string) avoid-overlap, center,
      top, top-right, right, bottom-right, bottom, bottom-left, left,
      top-left, inside, outside or near-origin.
     'label-position-negative' => (string) it only applies if
      the value is negative. If not given the value for
      data-label-position will be used
      top-left, inside, outside or near-origin.
     'hole-size' => (int) specifies the diameter of the inner hole
      of a ring chart as percentage of the outer diameter of the
      outermost ring.
     'pie-offset' => (int) specifies the distance of a segment from
      the center of the circle in case of circle charts. The offset
      is given as an integer which is interpreted as a percentage of
      the radius of the circle. In case of ring charts specifies an
      additional distance of a segment from the center of the circle.
      The distance is given as percentage of the thickness of the
      ring.
     'angle-offset' => (int) it specifies in degrees a counter
      clockwise rotation of a polar coordinate in a circle, ring or
      polar chart.
     'stacked' => (boolean) default value is false. it specifies the
      accumulation of the series values per category. Each value is
      in addition to the other values in the same category.
     'gap-width' => (int) specifies a gap between neighboring groups
      of bars in a bar/column chart. It is specified as an integer
      percentage relative to the width of a single bar
     'overlap' => (int) specifies how much bars within the same
      category in a bar/column chart overlap. The attribute value is
      an integer that is interpreted as a percentage relative to the
      width of a bar. Negative values specify gaps between bars
     'percentage' => (boolean) if true specifies a percentage
      accumulation of values per category
     'chart-interpolation' => (string) none (if points are to be
      connected by a straight line, b-spline or cubic-spline.
     'spline-resolution' => (int) a positive inetger. It only applies
      if the chart-interpolation option is not equal to none.
     'deep' => (boolean) if true the series will be shown
      in 3D one behind the other and not side by side. It only
      applies to 3D charts.
     'solid-type' => (string) cuboid (default), cylinder, cone or
      pyramid. It only applies to 3D bar charts.
 'style' => (string) a list of properties in CSS format that only
  set the global properties of the chart. In order to customize the
  different chart components you should use the associated
  chart methods.

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

Sets the 3D rotation angles and perspective

chart3DTransform( $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

with the following keys and values

 'rotate-x' => (int) rotation angle respect the x-axis (default
  value is 11)
 'rotate-y' => (int) rotation angle respect the y-axis (default
  value is 25)
 'rotate-z' => (int) rotation angle respect the z-axis (default
  value is 5)
 'right-angled-axes' => (boolean) default value is true (if true
  the rotate-z option is ignored)
 'perspective' => (int) given as a percentage (default value
  is 20)

Response

\Docxpresso\Core\Elements\ODFElement

sets the styles for the x, y and z chart axis

chartAxis(\Docxpresso\Core\Elements\(string) $axis,  $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$axis

\Docxpresso\Core\Elements\(string)

it may be x, y or z

$options

with the following keys and values

 'visible' => (boolean) default value is true
 'logarithmic' => (boolean) default value is false
 'font-color' => (string) hexadecimal color: #ff0000, ...
 'font-family' => (string) Arial, Calibri, ...
 'font-size' => (int) given in points
 'axis-position' => (mixed) it can be start (default), end or a
  numeric value dictating where the perpendicular axis shiould cross.
  In the case of the y-axis it refers to the category, i.e. 1 before
  the first category, 2 behind the second and so long so forth
 'minimum' => (float) specifies the minimun value of an axes
 'maximum' => (float) specifies the maximun value of an axes
 'label-arrangement' => (string) side-by-side, stagger-even or
  stagger-odd.
 'display-label' => (boolean) default value is true
 'axis-label-position' => (string) near-axis (default),
  near-axis-other-side, outside-end or outside-start
 'reverse-direction' => (boolean) default is false
 'text-overlap' => (boolean) default is false. It specifies
  whether axis labels may overlap each other
 'line-break' => (boolean) default is true. specifies whether
  word wrapping is allowed for axis labels
 'stroke' => (string) solid (default), dash or none.
 'stroke-width' => (string) given in points, cm or in. The defaults
  are: 0.75pt for major grids and 0.5pt for minor grids
 'stroke-color' => (string) hexadecimal color.
 'stroke-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke-linejoin' => (string) round (default), bevel, middle,
  miter or none
 'stroke-linecap' => (string) butt (default), round or square.
 'interval-major' => (float) specifies the separation between
  major intervals within an axis
 'interval-minor-divisor' => (integer) specifies the number of
  divisions between to major interval lines
 'tick-marks-major-inner' => (boolean) default value is false
 'tick-marks-minor-inner' => (boolean) default value is false
 'tick-marks-major-outer' => (boolean) default value is false
 'tick-marks-minor-outer' => (boolean) default value is false

Response

\Docxpresso\Core\Elements\ODFElement

sets the styles of the different chart components: wall and floor

chartComponent(string $component = 'wall',  $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$component

string

it can be wall or floor

$options

with the following keys and values

 'fill-color' => (string) hexadecimal color: #ffffff (default)
 'opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke' => (string) solid (default), dash or none.
 'stroke-width' => (string) given in points.
 'stroke-color' => (string) hexadecimal color.
 'stroke-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke-linejoin' => (string) round (default), bevel, middle,
  miter or none
 'stroke-linecap' => (string) butt (default), round or square.

Response

\Docxpresso\Core\Elements\ODFElement

inserts the data into the chart

chartData(array $data,  $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$data

array

$options

(array) an array of arrays each of them with the following keys and values:

 'fill-color' => (string) hexadecimal color.
 'opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke' => (string) solid (default), dash or none.
 'stroke-width' => (string) given in points, cm or in.
 'stroke-color' => (string) hexadecimal color.
 'stroke-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke-linejoin' => (string) round (default), bevel, middle,
  miter or none
 'stroke-linecap' => (string) butt (default), round or square.
 'solid-type' => (string) cuboid (default), cylinder, cone or
  pyramid. It only applies to 3D bar and column charts.

Response

\Docxpresso\Core\Elements\ODFElement

sets the styles for the x, y and z chart grids

chartGrid(\Docxpresso\Core\Elements\(string) $axis = 'x', \Docxpresso\Core\Elements\(string) $type = 'major',  $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$axis

\Docxpresso\Core\Elements\(string)

it may be x, y or z

$type

\Docxpresso\Core\Elements\(string)

it may be major or minor

$options

with the following keys and values

 'stroke' => (string) solid (default), dash or none.
 'stroke-width' => (string) given in points. The defaults
  are: 0.75pt for major grids and 0.5pt for minor grids
 'stroke-color' => (string) hexadecimal color. For major grids the
  default is #d9d9d9 and #f0f0f0 for minor grids
 'stroke-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke-linejoin' => (string) round (default), bevel, middle,
  miter or none
 'stroke-linecap' => (string) butt (default), round or square.

Response

\Docxpresso\Core\Elements\ODFElement

inserts a legend into the chart

chartLegend( $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

with the following keys and values

 'legend-position' => (string) left, right, top or bottom
 'color' => (string) hexadecimal value: #333333, ...
 'font-family' => (string) Arial, Calibri, ...
 'font-size => (string) (string) given in points, cm or in.
 'font-weight' => (string) bold or normal.
 'font-style' => (string) italic or normal.
 'fill-color' => (string) hexadecimal color: #ffffff (default)
 'fill-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke' => (string) solid (default), dash or none.
 'stroke-width' => (string) given in points, cm or in.
 'stroke-color' => (string) hexadecimal color.
 'stroke-opacity' => (string) percentage: 100% (default), 80%, ....
 'stroke-linejoin' => (string) round (default), bevel, middle,
  miter or none
 'stroke-linecap' => (string) butt (default), round or square.

Response

\Docxpresso\Core\Elements\ODFElement

adds a checkbox to a form within the document

checkbox(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name
 'value' => (string) the associated value
 'checked' => (bool) true or false
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) fro absolutely positioned controls (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

Inserts a column break into the document

columnBreak() : void
inherited
access

public

creates a document fragment that can be later inserted directly into the document or within another element

documentFragment(\Docxpresso\Core\Elements\ODFElement $odfNode = NULL) : \Docxpresso\Core\Elements\DocumentFragment
inherited

finish the current chaining and returns the "cursor" to the containing element. This method is particularly useful to stop chaining in deeply nested elements. The "back chaining" automatically stops at the root level if not containing element has been found.

end( $element = '') : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$element

it can take the following values: 'cell' 'chart', 'frame', 'endnote', 'footnote', 'link', 'list', 'math', 'paragraph', 'root', 'row', 'table', if element is left empty the method returns the root document element.

Response

\Docxpresso\Core\Elements\ODFElement

Inserts an endnote into a paragraph

endnote(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

the posible keys and values are:

 'label' => (string) the footnote label. You should not declare this
  option if you prefer automatic labelling.
 'note' => (mixed)  the note content. It can be a plain string of
  text or a Document Fragment object.
 'style' => (string) a list of properties in CSS format for the note.
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the form element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

adds a field that generates some "automatic content" out of the document structure (page numbers and count), the metadata or the like

field(string $type, array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$type

string

the available types are: author-name: the full author name bookmark-ref: reference to a bookmark page date: current date page-count: total number of pages page-number: current page number (with an optional offset) title: document title

$options

array

the possible keys and values are:

 'default-value' => (string) the field default value
 'number-format' => (string) used for page-count and page-number
     1: Hindu-Arabic number sequence, starts with 1 (default).
     a: number sequence of lowercase Modern Latin basic alphabet
     characters, starts with 'a'.
     A: number sequence of uppercase Modern Latin basic alphabet
     characters, starts with 'A'.
     i: number sequence of lowercase Roman numerals, starts with 'i'.
     I: number sequence of uppercase Roman numerals, start with 'I'.
 'number-offset' => (int) allows to start the numbering with a given
  offset. For example, if we would like to ignore the front page for
  page numbering we should choose a value of -1.
 'reference-format' => (string) used for bookmark-ref
     page: displays the number of the page on which the
     referenced item appears.
     text: displays the text of the referenced item.
 'reference-name' => (string) the name of the linked reference
 'date-format' => (array) the date is built by running consecutively
  through the array entries. possible values are:
     day: day of the month with two digits
     day-short: day of the month with one/two digits (as required)
     day-of-week: day of the week in textual format
     day-of-week-short: abbreviated day of the week in textual format
     month: month of the year with two digits
     month-short: month of the year with one/two digits (as required)
     month-of-year: month of year in textual form
     month-of-year-short: month of year in abbreviated textual form
     year: year number with four digits
     year-short: year number with 2 digits
     text (string): an arbitrary string of text
     Examples:
     1. array('day', '/', 'month', '/', 'year') yields 07/03/2014
     2. array('day-of-week', ' ', 'day-short', ', ' , 'month-of-year', ' ', 'year')
     yields Thursday 7, November-2014
 'style' => (string) a list of properties in CSS format

$reference

boolean

if true returns a reference to the form element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

Inserts an footnote into a paragraph

footnote(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

the posible keys and values are:

 'label' => (string) the footnote label. You should not declare this
  option if you prefer automatic labelling.
 'note' => (mixed)  the note content. It can be a plain string of
  text or a Document Fragment object.
 'style' => (string) a list of properties in CSS format for the note.
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the form element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

inserts a form container into the document. The form it self does not accept styling options so if you want to include them you should wrap the form within a table, frame or section element.

form(array $options, boolean $reference = true) : void
inherited
access

public

Arguments

$options

array

the avalaible key and values are: 'name' => (string) a unique name that identifies the form. If not given will be automatically generated. 'target' => (string) that can be '_blank (default), _self or _top or a frame name 'action' => (string) points to the URL (if any) where the data of the form should be sent and processed 'method' => (string) may be get (default) or post

$reference

boolean

if true returns a reference to the form element so further elements can be nested. The default value is true.

adds a frame to the document The frame can be floating or enjoy absolute or relative positioning

frame(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) for absolutely positioned frames (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

gets the first ancestor that accepts the ODFElement that we are trying to insert

getAncestor(\Docxpresso\Core\Elements\ODFElement $odfNode, array $allowedNodes) : \Docxpresso\Core\Elements\ODFNode
inherited
access

public

Arguments

$allowedNodes

array

where the keys must be the allowed tags and the value should be set to true. The method in_array is not used to improve performance

Response

\Docxpresso\Core\Elements\ODFNode

get the current style

getCurrentStyleId() : string
inherited
access

public

Response

string

detects if and ODF node has childs

getHasODFChild() : boolean
inherited
access

public

Response

boolean

gets the DOMNode associated with an ODF node

getNode() : \Docxpresso\Core\Elements\DOMNode
inherited
access

public

Response

\Docxpresso\Core\Elements\DOMNode

gets the node type

getNodeType() : string
inherited
access

public

Response

string

gets the parent of an ODF element

getParentODFElement() : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Response

\Docxpresso\Core\Elements\ODFElement

gets the style id

getStyleId() : string
inherited
access

public

Response

string

gets the target

getTarget() : string
inherited
access

public

Response

string

adds a header to a document section

header(array $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'section' => (int) the section number. If not given it is assumed
 that the header will be inserted in the current section
 'left-page' => (bool) if true the header will be specific of left
 pages only
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

Response

\Docxpresso\Core\Elements\ODFElement

adds a heading to the document

heading(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'level' => (int) the heading level: 1 (h1), 2 (h2),... up to 6
 'text' => (string)  an optional text (it can also be added later
  with the text method)
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'enforce' => (bool) if set to true and the current element does not
 accept paragraphs the method searches for the first ancestor that
 allows for the isnsertion. Beware that the return element is a
 reference to the inserted paragraph and the chaining may result
 affected consequently!!

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

adds an "horizontal rule" to the document

hr(array $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

Response

\Docxpresso\Core\Elements\ODFElement

This method allows to "insert" HTML content into the document

html(array $options) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

the available keys and values are: 'baseURL' => (string) if set enforces the base URL used for relative paths, otherwise it will be autodetected (if possible). 'encoding' => (string) if set enforces the encoding to be used otherwise it will be autodetected. 'isFile' => (boolean) true if the HTML code has to be retrieved from a file. Default value is false, i.e. the HTML is a string. 'context' => (array) this option is only taken into account if we need to fetch the HTML code via a http request. Its use is optional and if not set standard values, valid in the majority of cases, will be used. This option sets the http context (headers) for the http request. Depending on the server this option may be mandatory, i.e. the server will not return anything unless it receives this additional info. The keys and values are(http://www.php.net/manual/en/context.http.php):

 'method': GET (default value) or POST.
 'header': an array with the required headers that may include among
  others: 'Referer', 'User-agent', 'Referer', 'Connection', ...
 'proxy':address of the proxy server
 'request_fulluri' true or false (default).
 'follow_location': Follow Location header redirects. Set to 0
  to disable. Default value is 1.
 'max_redirects'The maximum number of redirects to follow.
  1 or less means that no redirects are followed (default is 20).
 'protocol_version': HTTP protocol version (default is 1.0).

'html' => (string) it can be a string of HTML code or the path to the the path to the HTML file if the 'isFile' option is set to true.

Response

\Docxpresso\Core\Elements\ODFElement

adds an image into the document The images can be inserted inline (default) or floating to the left or right

image(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'src' => (string) path to the image we want to insert
 'title' => (string) the image title should be included for
  accesibility reasons
 'description' => (string) the image description should be included
  for accesibility reasons
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the image element so further elements can be nested. The default value is false.

Response

\Docxpresso\Core\Elements\ODFElement

adds an input field to a form within the document

inputField(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name.
 'value' => (string) the associated default value, if any.
 'style' => (string) a list of properties in CSS format.
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) for absolutely positioned controls (optional).

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

inserts a document fragment previously created with the documentFragment method

insertDocumentFragment(\Docxpresso\Core\Elements\DocumentFragment $fragment) : \Docxpresso\Core\Elements\ODFElement
inherited

Inserts a line break into the document

lineBreak() : void
inherited
access

public

adds a list item within a list

listItem(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'text' => (mixed)  a string with an optional text (it can also be
  added later with the text or paragraph methods) or a
  documentFragment object
 'enforce' => (bool) if set to true (default) and the current element
 does not accept paragraphs the method searches for the first
 ancestor that allows for the insertion. Beware that the return
 element is a reference to the inserted listItem and the chaining
 may result affected consequently!!

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

adds a math equation to the document The equations can be inserted inline (default) or floating to the left, right or center.

math(string $equation, array $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$equation

string

the equation that we want to insert in MathML 1.0 or StarMath 5.0 format

$options

array

with the following keys and values

 'math-settings' => (array) with the following keys and values:
     'base-font-size' => (int) base font size used in the equation.
      The default size is 12 (pt).
     'rel-text-size' => (int) relative text size (default: 100)
     'rel-indexes-size' => (int) relative index size (default: 60)
     'rel-functions-size' => (int) relative function size (default: 100)
     'rel-operators-size' => (int) relative operator size (default: 100)
     'rel-limits-size' => (int) relative limit size (default: 60)
     'variables-font' => (string) default is Times New Roman
     'functions-font' => (string) default is Times New Roman
     'numbers-font' => (string) default is Times New Roman
     'text-font' => (string) default is Times New Roman
     'custom-serif-font' => (string) default is Times New Roman
     'custom-sans-serif-font' => (string) default is Arial
     'custom-fixed-font' => (string) default is Courier New
 'type' => (string) it can be MathML (default) or StarMath
 'style' => (string) a list of properties in CSS format

NOTE: Only MathML 1.0 is supported. You can check the documentation in

   http://www.w3.org/TR/1998/REC-MathML-19980407/.
   For StarMath 5.0 syntax you may refer to the official docs in:
   https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Math_Guide/Math_commands_reference
   http://www.openoffice.org/documentation/manuals/oooauthors/MathObjects.pdf

Response

\Docxpresso\Core\Elements\ODFElement

adds an unordered list to the document

orderedList(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'items' => (array) a (nested) array with the items to be included
 in the list (plain text or document fragments). This argument is
 optional because the items can also be added via the itemList
 method.
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'enforce' => (bool) if set to true (default) and the current element
 does not accept paragraphs the method searches for the first
 ancestor that allows for the insertion. Beware that the return
 element is a reference to the inserted paragraph and the chaining
 may result affected consequently!!

$reference

boolean

if true returns a reference to the image element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

Inserts a page break into the document

pageBreak() : void
inherited
access

public

adds a paragraph to the document

paragraph(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'text' => (mixed)  a string with an optional text (it can also be
 added later with the text method) or a documentFragment object
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'enforce' => (bool) if set to true (default) and the current element
 does not accept paragraphs the method searches for the first
 ancestor that allows for the insertion. Beware that the return
 element is a reference to the inserted paragraph and the chaining
 may result affected consequently!!

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

Moves one step up in the ODF 'block' element tree.

parent( $element = '') : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$element

it can take the following values: 'list', 'paragraph', 'section', 'table', 'row', 'cell', 'chart', 'frame', 'root' if element is left empty the method returns the first parent that fits one of the previous values.

Response

\Docxpresso\Core\Elements\ODFElement

Moves one list up in the ODF element tree

parentList() : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Response

\Docxpresso\Core\Elements\ODFElement

adds plain text into a node that accepts it directly.

plainText(string $text) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$text

string

Response

\Docxpresso\Core\Elements\ODFElement

returns the XML node code

printXML() : string
inherited
access

public

Response

string

adds a radio button to a form within the document

radioButton(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name. Radio buttons belonging to the
 same group should share the same name
 'value' => (string) the associated value
 'selected' => (bool) true or false. only one readio button should be
 selected by group otherwise use a checkbox control component
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) fro absolutely positioned controls (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

adds a table row to a table

row(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'header' => (boolean) if true it is a header row. If a table spans
  trough more than one page the header rows are repeated at the
  beginning of each new page.
 'row-content' => (array)  the row content. Each array item may be a
  string of text or a document fragment. Beware that you may have
  higher control by using the cell method to insert content
  into a row.
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

adds a dropdown select to a form within the document

select(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name.
 'items' => (array) an associative array with keys as options and
 values the corresponding form values
 'selected' => (string) the name of the selected item
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) for absolutely positioned controls (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

set the current style

setCurrentStyleId(string $styleId) : void
inherited
access

public

Arguments

$styleId

string

sets the the _hasODFChild property

setHasODFChild(boolean $odfChild) : void
inherited
access

public

Arguments

$odfChild

boolean

sets the _node property

setNode(\Docxpresso\Core\Elements\DOMNode $node) : void
inherited
access

public

Arguments

$node

\Docxpresso\Core\Elements\DOMNode

sets the _nodeType property

setNodeType(string $type) : void
inherited
access

public

Arguments

$type

string

sets the _parentODFElement property

setParentODFElement(\Docxpresso\Core\Elements\ODFElement $odfElement) : void
inherited
access

public

Arguments

sets the styleId property

setStyleId(string $styleId) : void
inherited
access

public

Arguments

$styleId

string

sets the target

setTarget(string $target) : void
inherited
access

public

Arguments

$target

string

Adds an style to an element

style(mixed $style = '') : void
inherited
access

public

Arguments

$style

mixed

it can be a CSS like properties string or an array

adds a tab to a run of text

tab(array $options = array()) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'type' => (string)  the accepted values are left, center, right or
  char (in this case the text will be aligned in reference to a
  specified character)
 'character' => (string) the character to be used in if the type is
  char (the default value is '.')
 'leader' => (string) the available style are:
     none: tab stop has no leader line.
     dash: tab stop has a dashed leader line.
     dot-dash: tab stop has a dot followed by a dash.
     dot-dot-dash: tab stop has two dots followed by a dash.
     dotted: tab stop has a dotted leader line.
     long-dash: tab stop has a long dash line.
     solid: tab stop has a solid leader line.
     wave: tab stop has a wavy leader line.
 'position' => (int) distance from the left margin or the left indent
  given in points.

Response

\Docxpresso\Core\Elements\ODFElement

adds a table to the document

table(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'table-content' => (array)  an optional array of arrays with the
  values to be included in the different table rows and cells.
  Each final entry may be an string of text or a document fragment. Beware that you can get higher control
  by including the table contents via the row and cell methods.
 'grid' => (mixed) mandatory if the data option is not set.
  It may be:
     The number of columns (integer): all columns are of equal size
     An array where each item represents the respective column width
 'style' => (string) a list of properties in CSS format
 'mask' => (array) this array stablishes the table theme options that
  should be applied to the current table. The default values are:
  array( 'NE'          => true,
         'NW'          => true,
         'SE'          => true,
         'SW'          => false,
         'firstRow'    => true,
         'lastRow'     => false,
         'bandedRow'   => true,
         'firstCol'    => true,
         'lastCol'     => false,
         'bandedCol'   => false)
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the paragraph element. The default value is true

Response

\Docxpresso\Core\Elements\ODFElement

adds text into a paragraph If we try to insert directly text into the document a wrapping paragraph with default styles will be automatically created

text(array $options, boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'nestSpans' => (boolean) if set to true the text spans will be
  nested. Default value is false
 'text' => (string)  the text to insert
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the text element so they can be nested.

Response

\Docxpresso\Core\Elements\ODFElement

adds a text area to a form within the document

textArea(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'form-name' => (string) the name of the form where we want to insert
 this control
 'name' => (string) the control name
 'value' => (string) the associated value
 'scroll' => (boolean) if true (default) the text area shows vertical
 scrollbars
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'pageNumber' => (int) for absolutely positioned controls (optional)

$reference

boolean

if true returns a reference to the frame element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

adds text box into the document The text box can be inserted inline (default) or floating to the left or right

textBox(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'pageNumber' => (int) for absolutely positioned textboxes (optional)
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly

$reference

boolean

if true returns a reference to the image element so further elements can be nested. The default value is false.

Response

\Docxpresso\Core\Elements\ODFElement

adds a table of contents to the document

toc(array $options = array()) : \Docxpresso\Core\Elements\CreateDocument
inherited
access

public

Arguments

$options

array

with the following keys and values

 'auto-update' => (boolean) if true (default value) the  TOC will
  automatically update on openning and the user will not be prompted
  to do so. This option is ignored unless the target document

is in Open Document Format (.odt)

 'leader-char' => (string) the leader char the joins the name of the
  heading with its page number. The default value is '.'.
 'linked' => (boolean) if true (default value) the toc entry is
  linked to the corresponding heading so on can navegate through the
  contents from the toc.
 'outline-level' => (int) an integer number (smaller than 10) that
  sets the the highest heading level that wil show up in the toc. The
  default value is 3.
 'title' => (string) The title, if any, of the table of contents. The
  format is given in the first array entry of the style option
 'style' => (array) an array with the styles in CSS format
  for the title (style[0]) and the toc levels (the j-th level style
  being given by style[j]).

Response

\Docxpresso\Core\Elements\CreateDocument

adds an unordered list to the document

unorderedList(array $options = array(), boolean $reference = true) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$options

array

with the following keys and values

 'items' => (array) a (nested) array with the items to be included
 in the list (plain text or document fragments). This argument is
 optional because the items can also be added via the itemList
 method.
 'style' => (string) a list of properties in CSS format
 'styleId' => (string) if given the styleId is not generated randomly
 'enforce' => (bool) if set to true (default) and the current element
 does not accept paragraphs the method searches for the first
 ancestor that allows for the insertion. Beware that the return
 element is a reference to the inserted paragraph and the chaining
 may result affected consequently!!

$reference

boolean

if true returns a reference to the image element so further elements can be nested. The default value is true.

Response

\Docxpresso\Core\Elements\ODFElement

adds extra whitespace within a paragraph or run of text If we try to insert directly text into the document a wrapping paragraph with default styles will be automatically created

whitespace(integer $number = 1) : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$number

integer

the number of whitespaces we want to insert

Response

\Docxpresso\Core\Elements\ODFElement

inserts a chart into a document with all data and styling options encoded in a XML string.

XMLChart(string $xml, string $styleId = '') : \Docxpresso\Core\Elements\ODFElement
inherited
access

public

Arguments

$xml

string

with the following structure <chart style="CSS styles"

  type="column|bar|pie|donut|area|line|scatter|bubble|radar|filled-radar|column-line|3Dcolumn|3Dbar|3Dpie|3Ddonut|3Darea|3Dline|3Dscatter"
   data-label-number="none|value|percentage"
   label-position="avoid-overlap|center|top|top-right|right|bottom-right|bottom|bottom-left|left|top-left|inside|outside|near-origin"
   label-position-negative="top-left|inside|outside|near-origin"
   hole-size="integer"
   pie-offset="integer"
   angle-offset="integer"
   stacked="boolean"
   gap-width="integer"
   overlap="integer"
   percentage="boolean"
   chart-interpolation="none|b-spline|cubic-spline"
   spline-resolution="integer"
   deep="boolean"
   solid-type="cuboid|cylinder|cone|pyramid" >
<title color="hexadecimal color"
       font-family="string"
       font-size="float(pt|cm|in|mm)"
       font-weight="normal|bold"
       font-style="normal|italic"
       stroke="solid|dash|none"
       fill-color="hexadecimal color"
       opacity="integer%"
       stroke-width="float(pt|cm|in|mm)"
       stroke-color="hexadecimal color"
       stroke-opacity="integer%"
       stroke-linejoin="round|bevel|middle|miter|none"
       stroke-linecap="butt|round|square" >Title</title>
<legend name="" //only applies to bubble charts
        legend-position="left|right|top|bottom"
        color="hexadecimal color"
        font-family="string"
        font-size="float(pt|cm|in|mm)"
        font-weight="normal|bold"
        font-style="normal|italic"
        stroke="solid|dash|none"
        fill-color="hexadecimal color"
        opacity="integer%"
        stroke-width="float(pt|cm|in|mm)"
        stroke-color="hexadecimal color"
        stroke-opacity="integer%"
        stroke-linejoin="round|bevel|middle|miter|none"
        stroke-linecap="butt|round|square"/>
<grid dimension="x|y|z"
      type="major|minor"
      stroke="solid|dash|none"
      stroke-width="float(pt|cm|in|mm)"
      stroke-color="hexadecimal color"
      stroke-opacity="integer%"
      stroke-linejoin="round|bevel|middle|miter|none"
      stroke-linecap="butt|round|square" />
<axis dimension="x|y|z"
      visible="boolean"
      logarithmic="boolean"
      font-color="hexadecimal color"
      font-size="float(pt|cm|in|mm)"
      axis-position="start|end"
      origin="float"
      maximum="float"
      minimum ="float"
      label-arrangement="side-by-side|stagger-even|stagger-odd"
      display-level="boolean"
      axis-label-position="near-axis|near-axis-other-side|outside-end|outside-start"
      reverse-direction="boolean"
      text-overlap="boolean"
      line-break="boolean"
      stroke="solid|dash|none"
      stroke-width="float(pt|cm|in|mm)"
      stroke-color="hexadecimal color"
      stroke-opacity="integer%"
      stroke-linejoin="round|bevel|middle|miter|none"
      stroke-linecap="butt|round|square"
      interval-major="float"
      interval-minor-divisor="integer"
      tick-marks-major-inner="boolean"
      tick-marks-minor-inner="boolean"
      tick-marks-major-outer="boolean"
      tick-marks-minor-outer="boolean" />
<component type="wall|floor"
           fill-color="hexadecimal color"
           opacity="integer%"
           stroke="solid|dash|none"
           stroke-width="float(pt|cm|in|mm)"
           stroke-color="hexadecimal color"
           stroke-opacity="integer%"
           stroke-linejoin="round|bevel|middle|miter|none"
           stroke-linecap="butt|round|square" />
<transform3D rotate-x="integer"
             rotate-y="integer"
             rotate-z="integer"
             right-angled-axes="true|false"
             perspective="integer" />
<!-- for pie and donut charts -->
<categories>
    <category name=""
              value=""
              fill-color="hexadecimal color"
              opacity="integer%"
              stroke="solid|dash|none"
              stroke-width="float(pt|cm|in|mm)"
              stroke-color="hexadecimal color"
              stroke-opacity="integer%" />
    <category name=""
              value=""
              fill-color="hexadecimal color"
              opacity="integer%"
              stroke="solid|dash|none"
              stroke-width="float(pt|cm|in|mm)"
              stroke-color="hexadecimal color"
              stroke-opacity="integer%" />
    <category name=""
              value=""
              fill-color="hexadecimal color"
              opacity="integer%"
              stroke="solid|dash|none"
              stroke-width="float(pt|cm|in|mm)"
              stroke-color="hexadecimal color"
              stroke-opacity="integer%" />
</categories>
<!-- for bubble charts -->
<series>
    <ser name=""
         fill-color="hexadecimal color"
         opacity="integer%"
         stroke="solid|dash|none"
         stroke-width="float(pt|cm|in|mm)"
         stroke-color="hexadecimal color"
         stroke-opacity="integer%" />
</series>
<categories>
    <category>
        <data value="" />
        <data value="" />
        <data value="" />
    </category>
    <category>
        <data value="" />
        <data value="" />
        <data value="" />
    </category>
    <category>
        <data value="" />
        <data value="" />
        <data value="" />
    </category>
</categories>
<!-- for all other charts -->
<series>
    <ser name=""
         fill-color="hexadecimal color"
         opacity="integer%"
         stroke="solid|dash|none"
         stroke-width="float(pt|cm|in|mm)"
         stroke-color="hexadecimal color"
         stroke-opacity="integer%" />
    <ser name=""
         fill-color="hexadecimal color"
         opacity="integer%"
         stroke="solid|dash|none"
         stroke-width="float(pt|cm|in|mm)"
         stroke-color="hexadecimal color"
         stroke-opacity="integer%" />
</series>
<categories>
    <category name="">
        <data value="" />
        <data value="" />
    </category>
    <category name="">
        <data value="" />
        <data value="" />
    </category>
    <category name="">
        <data value="" />
        <data value="" />
    </category>
</categories>

$styleId

string

Response

\Docxpresso\Core\Elements\ODFElement

Properties

the style id of the current element

_currentStyleId : string
inherited
var
access

private

Type(s)

string

the document DOMDocument element

_dom : \Docxpresso\Core\Elements\DOMDocument
inherited
var
access

private

Type(s)

\Docxpresso\Core\Elements\DOMDocument

the DOMNode element of the current ODFElement

_node : \Docxpresso\Core\Elements\DOMNode
inherited
var
access

private

Type(s)

\Docxpresso\Core\Elements\DOMNode

(a string or false)

_hasODFChild : mixed
inherited
var

(a string or false)

access

private

Type(s)

mixed

a reference to the parent ODFElement

_parentODFElement : \Docxpresso\Core\Elements\ODFElement
inherited
var
access

private

Type(s)

\Docxpresso\Core\Elements\ODFElement

the style id

_styleId : string
inherited
var
access

private

Type(s)

string

the ODFElement target

_target : string
inherited
var
access

private

Type(s)

string