create
[ class tree: create ] [ index: create ] [ all elements ]

Class: CreateDocx

Source Location: /CreateDocx.inc

Class Overview

CreateDocument
   |
   --CreateDocx

Abstract class used for creating documents


Author(s):

Version:

  • 2.2

Copyright:

  • Copyright (c) 2009-2013 Narcea ProduCiones Multimedia S.L. (http://www.2mdc.com)

Variables

Constants

Methods



Class Details

[line 21]
Abstract class used for creating documents



Tags:

version:  2.2
copyright:  Copyright (c) 2009-2013 Narcea ProduCiones Multimedia S.L. (http://www.2mdc.com)


[ Top ]


Class Variables

static $intIdWord =

[line 93]



Tags:

access:  public

Type:   int


[ Top ]

static $log =

[line 100]



Tags:

access:  public

Type:   Logger


[ Top ]

static $numOL =

[line 48]



Tags:

access:  public

Type:   integer


[ Top ]

static $numUL =

[line 42]



Tags:

access:  public

Type:   integer


[ Top ]

static $orderedListStyle =

[line 55]



Tags:

access:  public

Type:   string


[ Top ]

static $PHPDOCXStyles =

[line 35]



Tags:

access:  public

Type:   string


[ Top ]

static $unorderedListStyle =

[line 62]



Tags:

access:  public

Type:   string


[ Top ]

$fileGraphicTemplate =

[line 68]



Tags:

access:  public

Type:   array


[ Top ]

$graphicTemplate =

[line 86]



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


static method docx2txt [line 4430]

static void docx2txt( $from, array $to, [ $options = array()], string $path.)

Transform a word document to a text file



Tags:

access:  public
example:  example


Parameters:

string   $path.   Path to the text file output
array   $to   styles. Declares if we want to change the default styles of phpdocx keys: table => true/false,list => true/false, paragraph => true/false, footnote => true/false, endnote => true/false, chart => (0=false,1=array,2=table)
   $from  
   $options  

[ Top ]

static method getTempDir [line 6924]

static string getTempDir( )

To add support of sys_get_temp_dir for PHP versions under 5.2.1



Tags:

access:  public


[ Top ]

constructor __construct [line 540]

CreateDocx __construct( [ $baseTemplatePath = PHPDOCX_BASE_TEMPLATE], [ $tempDir = null], string $baseTemplatePath., string $tempDir.)

Construct



Tags:

access:  public


Parameters:

string   $baseTemplatePath.   Optional, basicTemplate.docx as default
string   $tempDir.   Change temp directory
   $baseTemplatePath  
   $tempDir  

[ Top ]

destructor __destruct [line 1335]

void __destruct( )

Destruct



Tags:

access:  public


[ Top ]

method addBackgroundImage [line 1718]

void addBackgroundImage( string $path)

Adds a background image to the document



Tags:

access:  public
example:  example


Parameters:

string   $path  

[ Top ]

method addBasicHTML [line 1780]

void addBasicHTML( [string $html = '<html><body></body></html>'], [array $options = array()])



Tags:

deprecated:  
access:  public


Parameters:

string   $html  
array   $options  

[ Top ]

method addBookmark [line 1796]

void addBookmark( [array $options = array('type' => null, 'name' => null, 'rawWordML' => false)])

Adds a bookmart start or end tag



Tags:

access:  public
example:  example


Parameters:

array   $options   Values: 'type' (start, end) 'name' (string) 'rawWordML' (boolean)

[ Top ]

method addBreak [line 1842]

void addBreak( [string $options = array('type' => 'line', 'rawWordML' => false)])

Add a break



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

string   $options   Values: 'type' (line, page, column) 'rawWordML' (boolean)

[ Top ]

method addChart [line 1920]

void addChart( [array $options = array('rawWordML' => false)])

Add a chart



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

array   $options   Values: 'color' (1, 2, 3...), 'cornerP' (20, 30...), 'cornerX' (20, 30...), 'cornerY' (20, 30...), 'data' (array of values), 'font' (Arial, Times New Roman...), 'groupBar' (clustered, stacked), 'jc' (center, left, right), 'showPercent' (0, 1), 'sizeX' (10, 11, 12...), 'sizeY' (10, 11, 12...), 'textWrap' (0 (inline), 1 (square), 2 (front), 3 (back), 4 (up and bottom), 5 (clear)), 'title', 'type' (barChart, bar3DChart, bar3DChartCylinder, bar3DChartCone, bar3DChartPyramid, colChart, col3DChart, col3DChartCylinder, col3DChartCone, bar3DChartPyramid, pieChart, pie3DChart, lineChart, line3DChart, areaChart, area3DChart, radar, scatterChart, surfaceChart,ofpiechar, doughnut, bublechart) 'legendpos' (r, l, t, b, none), 'legendoverlay' (0, 1), 'border' (0, 1), 'haxlabel' horizontal axis label, 'vaxlabel' vertical axis label, 'showtable' (0, 1) show the table of values, 'vaxlabel_display' (rotated, vertical, horizontal), 'haxlabel_display' (rotated, vertical, horizontal), 'hgrid' (0, 1, 2, 3), 'vgrid' (0, 1, 2, 3), 'style' this work only in radar charts. 'gapWidth' distance between the pie and the second chart(ofpiechart) 'secondPieSize' : size of the second chart(ofpiechart) 'splitType' how decide to split the values :auto(Default Split), cust(Custom Split), percent(Split by Percentage), pos(Split by Position), val(Split by Value) 'splitPos' split position , integer or float 'custSplit' array of index to split 'subtype' type of the second chart pie or bar 'explosion' distance between the diferents values 'holeSize' size of the hole in doughnut type 'symbol' array of symbols(scatter chart) 'symbolSize' the size of the simbols 'smooth' smooth the line (scatter chart) 'wireframe' boolean(surface chart)to remove content color and only leave the border colors 'showValue' show the values inside the chart 'showCategory' show the category inside the chart 'rawWordML' (boolean)

[ Top ]

method addDateAndHour [line 2023]

void addDateAndHour( [array $options = array( 'dateFormat' => 'dd/MM/yyyy H:mm:ss', 'rawWordML' => false)])

Adds date and hour to the Word document



Tags:

access:  public
example:  example


Parameters:

array   $options   Style options to apply to the date Values: 'b' (on, off) 'color' (ffffff, ff0000...) 'font' (Arial, Times New Roman...) 'i' (on, off) 'jc' (both, center, distribute, left, right) 'pageBreakBefore' (on, off) 'sz' (1, 2, 3...) 'u' (dash, dotted, double, single, wave, words) 'widowControl' (on, off) 'wordWrap' (on, off) 'lineSpacing' 120, 240 (standard), 480... 'indent_left' 100... 'indent_right' 100... 'rawWordML' (boolean) 'dateFormat (string) dd/MM/yyyy H:mm:ss (default value) One may define a customised format like dd' of 'MMMM' of 'yyyy' at 'H:mm (resulting in 20 of December of 2012 at 9:30)

[ Top ]

method addDOCX [line 2079]

void addDOCX( [array $options = array('rawWordML' => false)])

Merge DOCX. Keep content and styles.



Tags:

access:  public
example:  example


Parameters:

array   $options   Values: 'pathDOCX' (string) path to DOCX 'rawWordML' (boolean)

[ Top ]

method addElement [line 2125]

Element addElement( string $type, [ $params = ''], array $parrams)

Add an element to embedd in other elements



Tags:

return:  object
deprecated:  
access:  public
example:  example
example:  example
example:  example


Parameters:

string   $type   Element type. Values: 'addImage', 'addGraphic', 'addLink', 'addTextBox', 'addText'
array   $parrams   Set of parameters. Values: same as elements
   $params  

[ Top ]

method addEndnote [line 2286]

void addEndnote( [ $options = array('rawWordML' => false)], array $options.)

Add an endnote



Tags:

access:  public
example:  example
example:  example


Parameters:

array   $options.   Values: 'font' (string) font family //TODO: include font family in wordML 'textDocument' (string)text to appear in the body of the document 'textEndnote' (string) text to appear in the endnote 'rawWordML' (boolean)
   $options  

[ Top ]

method addFont [line 2333]

void addFont( array $fonts)

Add a new font



Tags:

access:  public


Parameters:

array   $fonts   Fonts to add

[ Top ]

method addFooter [line 2355]

void addFooter( $footers, array $footer, array 1)

Add a footer.



Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

array   $footer  
array   1   Values: 'default'(object) WordMLFragment 'even' (object) WordMLFragment 'first' (object) WordMLFragment
   $footers  

[ Top ]

method addFootnote [line 2463]

void addFootnote( [array $options = array('rawWordML' => false)])

Add a footnote



Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

array   $options   Values: 'font' (string) font family //TODO 'textDocument'(string) text to appear in the document body 'textFootnote' (string) text to appear in the footnote 'rawWordML' (boolean)

[ Top ]

method addGraphic [line 2526]

void addGraphic( array $dats)

Add a graphic



Tags:

see:  CreateDocx::addChart()
deprecated:  Use addChart method
access:  public
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

array   $dats   Parameters of graphic Values: 'color' (1, 2, 3...), 'cornerP' (20, 30...), 'cornerX' (20, 30...), 'cornerY' (20, 30...), 'data' (array of values), 'font' (Arial, Times New Roman...), 'groupBar' (clustered, stacked), 'jc' (center, left, right), 'showPercent' (0, 1), 'sizeX' (10, 11, 12...), 'sizeY' (10, 11, 12...), 'textWrap' (0 (inline), 1 (square), 2 (front), 3 (back), 4 (up and bottom), 5 (clear)), 'title', 'type' (barChart, bar3DChart, colChart, col3DChart, pieChart, pie3DChart)

[ Top ]

method addGraphicImg [line 2609]

void addGraphicImg( [array $options = array('rawWordML' => false)])

Add a graphic image



Tags:

access:  public


Parameters:

array   $options   Values: 'color' (1, 2, 3, 4, 5), 'cornerX' (20, 30...), 'data' (array of values), 'sizeX' (10, 11, 12...), 'sizeY' (10, 11, 12...), 'title', 'type' (barChart, bar3DChart,colChart, col3DChart, pieChart, pie3DChart) 'rawWordML' (boolean)

[ Top ]

method addGraphicTemplate [line 2642]

void addGraphicTemplate( array $options)

Add a graphic template. Replace placeholder with a graphic



Tags:

access:  public


Parameters:

array   $options   Values: same as charts

[ Top ]

method addHeader [line 2720]

void addHeader( array $headers)

Add a header.



Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

array   $headers   Values: 'default'(object) WordMLFragment 'even' (object) WordMLFragment 'first' (object) WordMLFragment

[ Top ]

method addHTML [line 2827]

void addHTML( [array $options = array('html' => '', 'rawWordML' => false)])

Inserts HTML into a document as alternative content (altChunk).

This method IS NOT compatible with PDF conversion or Open Office (use embedHTML instead).




Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

array   $options   Values: 'html' (string) 'rawWordML' (boolean)

[ Top ]

method addImage [line 2879]

void addImage( [array $data = ''])

Add an image



Tags:

access:  public
example:  example
example:  example


Parameters:

array   $data   Values: 'border'(int) 1, 2, 3... 'borderDiscontinuous' (0, 1) 'font' (string) Arial, Times New Roman... 'jc' (center, left, right) 'name' (string) 'scaling' (int) 50, 100, .. 'sizeX' (int) 10, 11, 12... 'sizeY' (int) 10, 11, 12... 'dpi' (int) dots per inch 'spacingTop' (int) 10, 11... 'spacingBottom' (int) 10, 11... 'spacingLeft' (int) 10, 11... 'spacingRight' (int) 10, 11... 'textWrap' 0 (inline), 1 (square), 2 (front), 3 (back), 4 (up and bottom), 5 (clear)) 'target' (string): document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter 'rawWordML' (boolean)

[ Top ]

method addLink [line 2969]

void addLink( $text, [array $options = array('url' => '', 'font' => '', 'sz' => '', 'color' => '0000ff', 'u' => 'single', 'rawWordML' => false)])

Add a link



Tags:

see:  addText additional parameter: 'url' (string) URL
access:  public
example:  example
example:  example


Parameters:

array   $options  
   $text  

[ Top ]

method addList [line 3029]

void addList( array $data, [array $options = array('rawWordML' => false)])

Add a list



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example


Parameters:

array   $data   Values of the list
array   $options   Values: 'font' (string), Arial, Times New Roman, ... 'val' (int), 0 (clear), 1 (inordinate), 2(numerical) 'bullets' (array) 1 (ï‚·), 2 (o), 3 (ï‚§) 'rawWordML' (boolean)

[ Top ]

method addMacroFromDoc [line 3069]

void addMacroFromDoc( string $path)

Add a macro from a DOC



Tags:

access:  public


Parameters:

string   $path   Path to a file with macro

[ Top ]

method addMathDocx [line 3101]

void addMathDocx( string $path)

Convert a math eq to DOCX



Tags:

access:  public
example:  example


Parameters:

string   $path   Path to a file with math eq

[ Top ]

method addMathEq [line 3120]

void addMathEq( string $eq)

Add an existing math eq to DOCX



Tags:

access:  public
example:  example


Parameters:

string   $eq   Math eq

[ Top ]

method addMathMML [line 3133]

void addMathMML( string $eq)

Convert a math MML eq to DOCX



Tags:

access:  public


Parameters:

string   $eq   Math eq

[ Top ]

method addMHT [line 3152]

void addMHT( [array $options = array('rawWordML' => false)])

Add a MHT file.



Tags:

access:  public
example:  example


Parameters:

array   $options   Values: 'pathMHT' (string) path to the MHT file 'rawWordML' (boolean)

[ Top ]

method addNewBaseTemplate [line 3189]

void addNewBaseTemplate( $path, $name, [ $overwrite = false], string $path., string $name., boolean $overwrite.)

Add a new base template into the templates folder.



Tags:

access:  public


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
string   $name.   Must be a valid name for the new base template. It should include the extension
boolean   $overwrite.   Optional. If true overwrites any existing template with the given name
   $path  
   $name  
   $overwrite  

[ Top ]

method addObject [line 3227]

void addObject( [array $options = array('rawWordML' => false)])

Add an existing object (XLS or PPTX)



Tags:

todo:  Not finished method
access:  public


Parameters:

array   $options   Values: 'path' (string) path to the object 'type' (string) object type: xlsx, pptx 'rawWordML' (boolean)

[ Top ]

method addPageNumber [line 3307]

void addPageNumber( [mixed $type = 'numerical'], [array $options = array('defaultValue' => 1, 'rawWordML' => false)])

Adds a page number to the document WARNING: if the page number is not added to a header or footer the user may need to press F9 in the MS Word interface to update its value to the current page



Tags:

access:  public
example:  example
example:  example


Parameters:

mixed   $type   (String): numerical, alphabetical.
array   $options   Style options to apply to the numbering Values: 'b' (on, off) 'color' (ffffff, ff0000...) 'font' (Arial, Times New Roman...) 'i' (on, off) 'jc' (both, center, distribute, left, right) 'pageBreakBefore' (on, off) 'sz' (1, 2, 3...) 'u' (dash, dotted, double, single, wave, words) 'widowControl' (on, off) 'wordWrap' (on, off) 'lineSpacing' 120, 240 (standard), 480..., 'indent_left' 100..., 'indent_right' 100... 'defaultValue' (int) 'rawWordML' (boolean)

[ Top ]

method addParagraph [line 3357]

void addParagraph( array $parameters, array $options)

Adds a complex paragraph to a Word document



Tags:

see:  anchor) type bookmark: 'markerName' (string) type image: @see CreateDocx->addImage() 'position' (inline, left, right) types arc, curve, line, polyline, rect, roundrect, shape, oval: @see CreateDocx->addShape()
see:  CreateDocx->addText() 'spacingBottom' (int) bottom margin in points 'spacingTop'(int) top margin in points 'target' (string) document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter. 'rawWordML' (boolean)
access:  public
example:  example
example:  example


Parameters:

array   $options  
array   $parameters   : values: 'type' (text, lineBreak, link, bookmark, image, footnote, endnote, arc, curve, line, polyline, rect, roundrect, shape, oval)

[ Top ]

method addProperties [line 3474]

void addProperties( array $values)

Add properties to document



Tags:

access:  public
example:  example


Parameters:

array   $values   Parameters to use Values: 'title', 'subject', 'creator', 'keywords', 'description', 'category', 'contentStatus', 'Manager','Company', 'custom' ('name' => array('type' => 'value'))

[ Top ]

method addRawWordML [line 3520]

void addRawWordML( string $wml)

Add a raw WordML



Tags:

deprecated:  See addWordML
access:  public


Parameters:

string   $wml   WordML to add

[ Top ]

method addRTF [line 3536]

void addRTF( [array $options = array('rawWordML' => false)])

Add a RTF file. Keep content and styles.



Tags:

access:  public
example:  example


Parameters:

array   $options   Values: 'pathRTF' (string) path to the RTF file 'rawWordML' (boolean)

[ Top ]

method addSection [line 3589]

void addSection( [string $sectionType = 'nextPage'], [array $paperType = 'A4'], [array $options = array()])

Adds a section



Tags:

access:  public
example:  example


Parameters:

string   $sectionType   sectionType (string): nextPage, nextColumn, continuous, evenPage, oddPage
array   $paperType   paperType (string): A4, A3, letter, legal, A4-landscape, A3-landscape, letter-landscape, legal-landscape, custom
array   $options   options Values: width (int): measurement in twips (twentieths of a point) height (int): measurement in twips (twentieths of a point) numberCols (int): number of columns orient (string): portrait, landscape marginTop (int): measurement in twips (twentieths of a point) marginRight (int): measurement in twips (twentieths of a point) marginBottom (int): measurement in twips (twentieths of a point) marginLeft (int): measurement in twips (twentieths of a point) marginHeader (int): measurement in twips (twentieths of a point) marginFooter (int): measurement in twips (twentieths of a point) gutter (int): measurement in twips (twentieths of a point)

[ Top ]

method addShape [line 3628]

void addShape( string $type, [array $options = array('rawWordML' => false)])

Add a shape



Tags:

access:  public
example:  example


Parameters:

string   $type   Type of shape to draw Values:arc, curve, line, polyline, rect, roundrect, shape, oval
array   $options   General options: 'width' in points 'height' in points 'position' (absolute, relative) 'margin-top' in points 'margin-left' in points 'z-index' integer 'strokecolor' (#ff0000, #00ffff, ...) 'strokeweight' (1.0pt, 3.5pt, ...) 'fillcolor' (#ff0000, #00ffff, ...) 'rawWordML' (boolean) Options for especific type: arc: 'startAngle' (0, 45, 90, ...), 'endAngle' (0, 45, 90, ...) line and curve: 'from' and 'to' (initial and final points in x,y format) curve: 'control1' (x,y), 'control2' (x,y) polyline: 'points' (x1,y1 x2,y2 ....) roundrect: 'arcsize' (0.5, 1.8, ...) shape: 'path' (VML path), 'coordsize' (x,y)

[ Top ]

method addSubDocument [line 3650]

void addSubDocument( $originalPath, [string $destination = ''], string $path)

Add a subdocument to a master document. The document should be in the same folder as the final master document



Tags:

access:  public


Parameters:

string   $path   path to the subdocument
string   $destination   path to where the subdocument should be stored if empty is assumed to remain in its original folder
   $originalPath  

[ Top ]

method addTable [line 3682]

void addTable( array $data, [array $options = array('rawWordML' => false)])

Add a table.



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

array   $data   Values to add
array   $options   Parameters to use Values: 'border' (none, single, double); 'border_color' (ffffff, ff0000); 'border_spacing' (0, 1, 2...); 'border_sz' (10, 11...); 'font' (Arial, Times New Roman...); 'jc' (center, left, right); 'decimalTab' 'size_col': column width fix (1200, 1300...), column width variable (array); 'TBLSTYLEval' (string) Word table style; 'cantSplitRows' (boolean) 'rawWordML' (boolean)

[ Top ]

method addTableContents [line 3702]

void addTableContents( [string $font = ''])

Add a table of contents (TOC)



Tags:

access:  public
example:  example


Parameters:

string   $font   Set font type Values: 'Arial', 'Times New Roman'...

[ Top ]

method addTemplate [line 3726]

void addTemplate( string $path)

Add a DOCX file as a template



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

string   $path   Path to the template file

[ Top ]

method addTemplateChart [line 3757]

void addTemplateChart( string $var, string $chart)

Replace a variable with a chart.



Tags:

access:  public
example:  example


Parameters:

string   $var   Value of the variable
string   $chart   Chart to add Values: same as charts.

[ Top ]

method addTemplateCheckBox [line 3774]

void addTemplateCheckBox( string $var, [string $value = false])

Replace a variable with a checkbox.



Tags:

access:  public
example:  example


Parameters:

string   $var   Value of the variable. String
string   $value  

[ Top ]

method addTemplateImage [line 3792]

void addTemplateImage( string $var, string $pathImage)

Replace a variable image template with a new image.



Tags:

access:  public
example:  example
example:  example


Parameters:

string   $var   Value of the variable
string   $pathImage   Path of the new image

[ Top ]

method addTemplateVariable [line 3813]

void addTemplateVariable( mixed $var, [string $value = ''], [mixed $settings = ''])

Replace a variable with a text, HTML, DOCX, RTF, MHT.



Tags:

access:  public
example:  example
example:  example


Parameters:

mixed   $var   Value of the variable. String, html or array of values
string   $value   Text value, type of value, CSS or text array Values type of template: list, table,
mixed   $settings   Template settings or content type Content types: html, rtf, docx, mht

[ Top ]

method addText [line 3865]

void addText( mixed $textParams, [array $paragraphParams = array('rawWordML' => false)])

Add a text



Tags:

access:  public
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example
example:  example


Parameters:

mixed   $textParams   if a string just the text to be included, if an array is an array of arrays with each element containing the text to be inserted and their formatting properties Values: 'text' (string) the run of text to be inserted 'b' (on, off) 'color' (ffffff, ff0000...) 'font' (Arial, Times New Roman...) 'i' (on, off) 'lineBreak' (before, after, both) inserts a line break before, after or both, a run of text 'sz' (1, 2, 3...) 'u' (none, dash, dotted, double, single, wave, words)
array   $paragraphParams   Style options to apply to the whole paragraph Values: 'pStyle' (string) Word style to be used. Run parseStyles() to check all available paragraph styles 'b' (on, off) 'color' (ffffff, ff0000...) 'font' (Arial, Times New Roman...) 'i' (on, off) 'jc' (both, center, distribute, left, right) 'lineBreak' (before, after, both) inserts a line break before, after or both, a run of text 'pageBreakBefore' (on, off) 'sz' (1, 2, 3...) 'u' (none, dash, dotted, double, single, wave, words) 'widowControl' (on, off) 'wordWrap' (on, off) 'lineSpacing' 120, 240 (standard), 480..., 'indent_left' 100..., 'indent_right' 100... 'rawWordML' (boolean)

[ Top ]

method addTextBox [line 3903]

void addTextBox( array $text, [array $options = array('rawWordML' => false)])

Add a textbox



Tags:

access:  public
example:  example
example:  example


Parameters:

array   $text   these are the same parameters used in the addText method The first array entry is the text to be included in the text box, the second one is itself another array with all the standard text formatting options
array   $options   includes the specific textbox options Values: 'border' (int) 'border_color (string) color (black, red,...) or hexadecimal value (#ff0000, #0000ff, ...) 'align' (center, left, right) 'fillcolor' (string) color (black, red,...) or hexadecimal value (#ff0000, #0000ff, ...) 'width' (float) width in cm 'height' (float) height in cm 'textWrap' (tight, square, through, none) 'margin_left' (float) distance in cm 'margin_top' (float) distance in cm 'padding_bottom' (float) distance in cm 'padding_left' (float) distance in cm 'padding_right' (float) distance in cm 'padding_top' (float) distance in cm 'rawWordML' (boolean)

[ Top ]

method addTitle [line 3937]

void addTitle( string $text, [array $options = array('rawWordML' => false)])

Add a title



Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

string   $text   Text to add
array   $options   Values: 'type' (title, subtitle) 'b' (on, off) 'color' (ffffff, ff0000...) 'font' (Arial, Times New Roman...) 'i' (on, off) 'jc' (both, center, distribute, left, right) 'pageBreakBefore' (on, off), 'sz' (1, 2, 3...) 'u' (dash, dotted, double, single, wave, words) 'widowControl' (on, off) 'wordWrap' (on, off) 'rawWordML' (boolean)

[ Top ]

method addWordML [line 3958]

void addWordML( [array $options = array('rawWordML' => false)])

Adds WordML to the document.



Tags:

access:  public


Parameters:

array   $options   Values: 'wordML' (string) WordML to add 'rawWordML' (boolean)

[ Top ]

method cleanWordMLBlockElements [line 3974]

void cleanWordMLBlockElements( $wordML)

Eliminates all block type elements from a WordML string



Tags:

access:  public


Parameters:

   $wordML  

[ Top ]

method clearBlocks [line 3999]

void clearBlocks( )

Clear all blocks



Tags:

access:  public


[ Top ]

method createDocx [line 4017]

void createDocx( string $args[0], string $args[1])

Generate a new DOCX file



Tags:

access:  public
example:  example
example:  example


Parameters:

string   $args[0]   File name
string   $args[1]   Page style Values: 'bottom' (4000, 4001...), 'columns' (1, 2, 3), 'left' (4000, 4001...), 'orient' (landscape), 'right' (4000, 4001), 'titlePage' (1), 'top' (4000, 4001)

[ Top ]

method createDocxAndDownload [line 4355]

void createDocxAndDownload( string $args[0], string $args[1])

Generate and download a new DOCX file



Tags:

access:  public


Parameters:

string   $args[0]   Name of file
string   $args[1]   Page style Values: 'bottom' (4000, 4001...), 'left' (4000, 4001...), 'orient' (landscape), 'right' (4000, 4001), 'titlePage' (1), 'top' (4000, 4001)

[ Top ]

method createWordMLFragment [line 5671]

void createWordMLFragment( $data, mixed $data,)

Creates a WordML freagment.



Tags:

access:  public
example:  example
example:  example


Parameters:

mixed   $data,   string or array
   $data  

[ Top ]

method deleteTemplateBlock [line 4402]

void deleteTemplateBlock( string $blockName)

Delete a block



Tags:

access:  public


Parameters:

string   $blockName   Block to remove

[ Top ]

method disableDebug [line 4414]

void disableDebug( )

Disable debug mode



Tags:

deprecated:  
access:  public


[ Top ]

method embedHTML [line 4460]

void embedHTML( [string $html = '<html><body></body></html>'], [ $options = array()], array $options:)

Embed HTML into the Word document by parsing the HTML code and converting it into WordML It preserves many CSS styles



Tags:

access:  public
example:  example
example:  example
example:  example


Parameters:

string   $html   HTML to add. Must be a valid XHTML
array   $options:   isFile (boolean), baseURL (string), downloadImages (boolean), filter (string) could be an string denoting the id, class or tag to be filtered. If you want only a class introduce .classname, #idName for an id or <htmlTag> for a particular tag. One can also use standard XPath expresions supported by PHP. 'parseAnchors' (boolean), 'parseDivs' (paragraph, table): parses divs as paragraphs or tables, 'parseFloats' (boolean), 'strictWordStyles' (boolean) if true ignores all CSS styles and uses the styles set via the wordStyles option (see next) 'wordStyles' (array) associates a particular class, id or HTML tag to a Word style 'target' (string) document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter. 'rawWordML' (boolean)
   $options  

[ Top ]

method enableCompatibilityMode [line 4490]

void enableCompatibilityMode( )

Enable compatibility mode for OpenOffice and MS Office 2003 CP. Avoid using unsupported methods



Tags:

access:  public


[ Top ]

method enableDebug [line 4502]

void enableDebug( )

Enable debug mode



Tags:

deprecated:  
access:  public


[ Top ]

method generateBaseWordNumbering [line 7295]

void generateBaseWordNumbering( )

creates an empty word numbering base string



Tags:

access:  public


[ Top ]

method getExtension [line 1367]

void getExtension( )

Getter



Tags:

access:  public


[ Top ]

method getTemplateVariables [line 4515]

array getTemplateVariables( )

Return template variables (placeholders)



Tags:

access:  public
example:  example


[ Top ]

method getTemplateXML [line 4530]

array getTemplateXML( )

Return the XML of the given Template



Tags:

access:  public


[ Top ]

method getTemporaryDirectory [line 1386]

void getTemporaryDirectory( )

Getter



Tags:

access:  public


[ Top ]

method getXmlContentTypes [line 1406]

void getXmlContentTypes( )

Getter



Tags:

access:  public


[ Top ]

method getXmlDocPropsApp [line 1446]

void getXmlDocPropsApp( )

Getter



Tags:

access:  public


[ Top ]

method getXmlDocPropsCore [line 1466]

void getXmlDocPropsCore( )

Getter



Tags:

access:  public


[ Top ]

method getXmlDocPropsCustom [line 1486]

void getXmlDocPropsCustom( )

Getter



Tags:

access:  public


[ Top ]

method getXmlRelsRels [line 1426]

void getXmlRelsRels( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordDocumentContent [line 1506]

void getXmlWordDocumentContent( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordDocumentStyles [line 1526]

void getXmlWordDocumentStyles( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordEndnotes [line 1546]

void getXmlWordEndnotes( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordFontTable [line 1566]

void getXmlWordFontTable( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordFooter1 [line 1586]

void getXmlWordFooter1( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordHeader1 [line 1606]

void getXmlWordHeader1( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordRelsDocumentRels [line 1626]

void getXmlWordRelsDocumentRels( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordSettings [line 1646]

void getXmlWordSettings( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordStyles [line 1666]

void getXmlWordStyles( )

Getter



Tags:

access:  public


[ Top ]

method getXmlWordThemeTheme1 [line 1686]

void getXmlWordThemeTheme1( )

Getter



Tags:

access:  public


[ Top ]

method getXml_Word_WebSettings [line 1706]

void getXml_Word_WebSettings( )

Setter



Tags:

access:  public


[ Top ]

method importFontTableXML [line 4744]

void importFontTableXML( $path, string $path.)

Imports an existing fontTable.xml file from an existing docx document.



Tags:

access:  public


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
   $path  

[ Top ]

method importHeadersAndFooters [line 7327]

void importHeadersAndFooters( $path, [ $type = 'headerAndFooter'], string $path., string $type., array $options)

Inserts new headers and/or footers from a word file.



Tags:

access:  public
example:  example


Parameters:

string   $path.   Path to the docx from which we wish to import the header and/or footer
string   $type.   Declares if we want to import only the header, only the footer or both. Values: header, footer, headerAndFooter (default value)
array   $options   Values: 'first' (boolean) defaults to false
   $path  
   $type  

[ Top ]

method importSettingsXML [line 4724]

void importSettingsXML( $path, string $path.)

Imports an existing settings.xml file from an existing docx document.



Tags:

access:  public


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
   $path  

[ Top ]

method importSingleNumbering [line 7271]

void importSingleNumbering( string $numberingsXML, string $newNumbering, string $numberId, [ $originalAbstractNumId = ''])

Inserts a new numbering style.



Tags:

access:  public


Parameters:

string   $numberingsXML   the numberings.xml that we wish to modify
string   $newNumbering   the new numbering style we wish to add.
string   $numberId   a unique integer tha determines the numbering id and the abstract numbering id
   $originalAbstractNumId  

[ Top ]

method importStyles [line 4552]

void importStyles( $path, [ $type = 'replace'], [ $myStyles = array()], string $path., string $type., array $myStyles.)

Imports an existing style sheet from an existing docx document.



Tags:

access:  public
example:  example


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
string   $type.   You may choose 'replace' (overwrites the current styles) or 'merge' (adds the selected styles)
array   $myStyles.   A list of specific styles to be merged. If it is empty or the choosen type is 'replace' it will be ignored.
   $path  
   $type  
   $myStyles  

[ Top ]

method importThemeXML [line 4684]

void importThemeXML( $path, string $path.)

Imports an existing theme from an existing docx document.



Tags:

access:  public


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
   $path  

[ Top ]

method importWebSettingsXML [line 4704]

void importWebSettingsXML( $path, string $path.)

Imports an existing webSettings.xml file from an existing docx document.



Tags:

access:  public


Parameters:

string   $path.   Must be a valid path to an existing .docx, .dotx o .docm document
   $path  

[ Top ]

method mergeDOCX [line 4766]

void mergeDOCX( string $path, string $newXML)

Merge WordML into a DOCX. WordML is added at the end of the document



Tags:

access:  public
example:  example not found


Parameters:

string   $path   Path to DOCX file
string   $newXML   WordML to add

[ Top ]

method modifyPageLayout [line 4793]

void modifyPageLayout( [array $paperType = 'letter'], [array $options = array()])

Modify page layout



Tags:

access:  public
example:  example not found


Parameters:

array   $paperType   paperType (string): A4, A3, letter, legal, A4-landscape, A3-landscape, letter-landscape, legal-landscape, custom
array   $options   options Values: width (int): measuremt in twips (twentieths of a point) height (int): measuremt in twips (twentieths of a point) numberCols (int): measuremt in twips (twentieths of a point) orient (string): portrait, landscape marginTop (int): measuremt in twips (twentieths of a point) marginRight (int): measuremt in twips (twentieths of a point) marginBottom (int): measuremt in twips (twentieths of a point) marginLeft (int): measuremt in twips (twentieths of a point) marginHeader (int): measuremt in twips (twentieths of a point) marginFooter (int): measuremt in twips (twentieths of a point) gutter (int): measuremt in twips (twentieths of a point)

[ Top ]

method parseStyles [line 5006]

void parseStyles( [ $path = ''], string $path.)

Gets the Ids associated with the different styles in the current document or an external docx.

It returns a docx with all the avalaible paragraph, list and table styles.




Tags:

access:  public
example:  example


Parameters:

string   $path.   Optional, if empty lists de Ids of the current style sheet
   $path  

[ Top ]

method readDOCX [line 5296]

void readDOCX( string $path)

Parse DOCX file and extract content



Tags:

access:  public
example:  example


Parameters:

string   $path   Path to DOCX file

[ Top ]

method removeFooters [line 7189]

void removeFooters( )

Removes existing footers.



Tags:

access:  public


[ Top ]

method removeHeaders [line 7141]

void removeHeaders( )

Removes existing headers.



Tags:

access:  public


[ Top ]

method removeHeadersAndFooters [line 7131]

void removeHeadersAndFooters( )

Removes headers and footers.



Tags:

access:  public


[ Top ]

method replaceHeaderImage [line 5317]

void replaceHeaderImage( string $var, string $pathImage)

Replace a header image with a new image.



Tags:

access:  public
example:  example


Parameters:

string   $var   Value of the variable
string   $pathImage   Path of the new image

[ Top ]

method replaceTemplateVariableByHTML [line 5349]

void replaceTemplateVariableByHTML( string $var, type $type, [string $html = '<html><body></body></html>'], [ $options = array()], array $options:)

Replace a template variable with WordML obtained from HTML via the embedHTML method.



Tags:

access:  public
example:  example


Parameters:

string   $var   Value of the variable.
string   $html   HTML source
array   $options:   isFile (boolean), baseURL (string), downloadImages (boolean), filter (string) could be an string denoting the id, class or tag to be filtered. If you want only a class introduce .classname, #idName for an id or <htmlTag> for a particular tag. One can also use standard XPath expresions supported by PHP. 'parseAnchors' (boolean), 'parseDivs' (paragraph, table): parses divs as paragraphs or tables, 'parseFloats' (boolean), 'strictWordStyles' (boolean) if true ignores all CSS styles and uses the styles set via the wordStyles option (see next) 'wordStyles' (array) associates a particular class, id or HTML tag to a Word style
type   $type   inline or block
   $options  

[ Top ]

method setBackgroundColor [line 5377]

void setBackgroundColor( string $color)

Changes the background color of the document



Tags:

access:  public
example:  example


Parameters:

string   $color   Values: hexadecimal color value without # (ffff00, 0000ff, ...)

[ Top ]

method setDecimalSymbol [line 5417]

void setDecimalSymbol( string $symbol)

Change the default font



Tags:

access:  public


Parameters:

string   $symbol   Values: '.', ',',...

[ Top ]

method setDefaultFont [line 5472]

void setDefaultFont( string $font)

Change the default font



Tags:

access:  public
example:  example


Parameters:

string   $font   The new font Values: 'Arial', 'Times New Roman'...

[ Top ]

method setEncodeUTF8 [line 5524]

void setEncodeUTF8( )

Transform to UTF-8 charset



Tags:

access:  public


[ Top ]

method setExtension [line 1357]

void setExtension( $extension)

Setter



Tags:

access:  public


Parameters:

   $extension  

[ Top ]

method setLanguage [line 5535]

void setLanguage( [$lang $lang = DEFAULT_LANGUAGE])

Change default language.



Tags:

access:  public
example:  example


Parameters:

$lang   $lang   Locale: en-US, es-ES...

[ Top ]

method setMarkAsFinal [line 5589]

void setMarkAsFinal( )

Mark the document as final



Tags:

access:  public
example:  example


[ Top ]

method setTemplateSymbol [line 5606]

void setTemplateSymbol( [string $symbol = '$'])

Set the symbol surrounding varibles (placeholders)



Tags:

access:  public


Parameters:

string   $symbol   The new symbol. Optional, $ as default

[ Top ]

method setTemporaryDirectory [line 1376]

void setTemporaryDirectory( $tempDir)

Setter



Tags:

access:  public


Parameters:

   $tempDir  

[ Top ]

method setXmlContentTypes [line 1396]

void setXmlContentTypes( $xmlContentTypes)

Setter



Tags:

access:  public


Parameters:

   $xmlContentTypes  

[ Top ]

method setXmlDocPropsApp [line 1436]

void setXmlDocPropsApp( $xmlDocPropsApp)

Setter



Tags:

access:  public


Parameters:

   $xmlDocPropsApp  

[ Top ]

method setXmlDocPropsCore [line 1456]

void setXmlDocPropsCore( $xmlDocPropsCore)

Setter



Tags:

access:  public


Parameters:

   $xmlDocPropsCore  

[ Top ]

method setXmlDocPropsCustom [line 1476]

void setXmlDocPropsCustom( $xmlDocPropsCustom)

Setter



Tags:

access:  public


Parameters:

   $xmlDocPropsCustom  

[ Top ]

method setXmlRelsRels [line 1416]

void setXmlRelsRels( $xmlRelsRels)

Setter



Tags:

access:  public


Parameters:

   $xmlRelsRels  

[ Top ]

method setXmlWordDocument [line 1496]

void setXmlWordDocument( $xmlWordDocument)

Setter



Tags:

access:  public


Parameters:

   $xmlWordDocument  

[ Top ]

method setXmlWordDocumentStyles [line 1516]

void setXmlWordDocumentStyles( $xmlWordDocumentStyles)

Setter



Tags:

access:  public


Parameters:

   $xmlWordDocumentStyles  

[ Top ]

method setXmlWordEndnotes [line 1536]

void setXmlWordEndnotes( $xmlWordEndnotes)

Setter



Tags:

access:  public


Parameters:

   $xmlWordEndnotes  

[ Top ]

method setXmlWordFontTable [line 1556]

void setXmlWordFontTable( $xmlWordFontTable)

Setter



Tags:

access:  public


Parameters:

   $xmlWordFontTable  

[ Top ]

method setXmlWordFooter1 [line 1576]

void setXmlWordFooter1( $xmlWordFooter)

Setter



Tags:

access:  public


Parameters:

   $xmlWordFooter  

[ Top ]

method setXmlWordHeader1 [line 1596]

void setXmlWordHeader1( $xmlWordHeader)

Setter



Tags:

access:  public


Parameters:

   $xmlWordHeader  

[ Top ]

method setXmlWordRelsDocumentRels [line 1616]

void setXmlWordRelsDocumentRels( $xmlWordRelsDocumentRels)

Setter



Tags:

access:  public


Parameters:

   $xmlWordRelsDocumentRels  

[ Top ]

method setXmlWordSettings [line 1636]

void setXmlWordSettings( $xmlWordSettings)

Setter



Tags:

access:  public


Parameters:

   $xmlWordSettings  

[ Top ]

method setXmlWordStyles [line 1656]

void setXmlWordStyles( $xmlWordStyles)

Setter



Tags:

access:  public


Parameters:

   $xmlWordStyles  

[ Top ]

method setXmlWordThemeTheme1 [line 1676]

void setXmlWordThemeTheme1( $xmlWordThemeTheme)

Setter



Tags:

access:  public


Parameters:

   $xmlWordThemeTheme  

[ Top ]

method setXmlWordWebSettings [line 1696]

void setXmlWordWebSettings( $xmlWordWebSettings)

Setter



Tags:

access:  public


Parameters:

   $xmlWordWebSettings  

[ Top ]

method transformDocx [line 5622]

void transformDocx( string $docSource, string $docDestination, [string $tempDir = null])

Transform DOCX to PDF, ODT, SXW, RTF, DOC, TXT, HTML or WIKI



Tags:

access:  public
example:  example not found


Parameters:

string   $docSource  
string   $docDestination  
string   $tempDir  

[ Top ]

method transformDocxUsingMSWord [line 5643]

void transformDocxUsingMSWord( $docSource $docSource, $docDestination $docDestination)

If PHPDocX is installed in a server with a working copy of Word 2007 or newer you may use it to do format conversions.

Supported formats, DOCX and DOC to PDF, RTF, HTML and DOC




Tags:

access:  public


Parameters:

$docSource   $docSource   You should use the full Windows path to the docx (remember to escape backslashes)
$docDestination   $docDestination   ou should use the full Windows path to the docx (remember to escape backslashes)

[ Top ]

method txt2docx [line 5657]

void txt2docx( $text_filename, [array $options = array()], string $path.)

Insert the content of a text file into a word document trying to hold the styles



Tags:

access:  public
example:  example


Parameters:

string   $path.   Path to the text file from which we insert into docx document
array   $options   of style values keys: styleTbl, styleLst, styleP
   $text_filename  

[ Top ]

method __toString [line 1346]

string __toString( )

Magic method, returns current word XML



Tags:

return:  Return current word
access:  public


[ Top ]


Class Constants

NAMESPACEWORD =  'w'

[line 23]


[ Top ]

SCHEMA_IMAGEDOCUMENT =
    'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'

[line 24]


[ Top ]

SCHEMA_OFFICEDOCUMENT =
    'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'

[line 26]


[ Top ]



Documentation generated on Tue, 08 Jan 2013 15:19:00 +0100 by phpDocumentor 1.4.4