Class CreateDocx

Description

Abstract class used for creating documents

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

Located in /CreateDocx.inc (line 21)

CreateDocument
   |
   --CreateDocx
Class Constant Summary
SCHEMA_IMAGEDOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'
SCHEMA_OFFICEDOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'
Variable Summary
static int $intIdWord
static Logger $log
static integer $numOL
static integer $numUL
static string $orderedListStyle
static string $PHPDOCXStyles
static array $settings
static string $unorderedListStyle
Method Summary
static void docx2txt ( $from, array $to, [ $options = array()], string $path.)
static string getTempDir ()
CreateDocx __construct ([ $baseTemplatePath = PHPDOCX_BASE_TEMPLATE], string $baseTemplatePath.)
void __destruct ()
void addBreak ([string $options = array('type' => 'line')])
void addChart ([array $options = array()])
void addImage ([array $data = ''])
void addLink ( $text, [array $options = array('url' => '', 'font' => '', 'sz' => '', 'color' => '0000ff', 'u' => 'single', )])
void addList (array $data, [array $options = array()])
void addRawWordML (string $wml)
void addTable (array $tableData, [array $tableProperties = array()], [array $rowProperties = array()])
void addText (mixed $textParams, [array $paragraphParams = array()])
void createDocx (string $args[0], string $args[1])
void getExtension ()
void getXmlRelsRels ()
void setEncodeUTF8 ()
void setExtension ( $extension)
void setLanguage ([$lang $lang = null])
void setTemporaryDirectory ( $tempDir)
void setXmlContentTypes ( $xmlContentTypes)
void setXmlDocPropsApp ( $xmlDocPropsApp)
void setXmlDocPropsCore ( $xmlDocPropsCore)
void setXmlDocPropsCustom ( $xmlDocPropsCustom)
void setXmlRelsRels ( $xmlRelsRels)
void setXmlWordDocument ( $xmlWordDocument)
void setXmlWordDocumentStyles ( $xmlWordDocumentStyles)
void setXmlWordEndnotes ( $xmlWordEndnotes)
void setXmlWordFontTable ( $xmlWordFontTable)
void setXmlWordFooter1 ( $xmlWordFooter)
void setXmlWordHeader1 ( $xmlWordHeader)
void setXmlWordRelsDocumentRels ( $xmlWordRelsDocumentRels)
void setXmlWordSettings ( $xmlWordSettings)
void setXmlWordStyles ( $xmlWordStyles)
void setXmlWordThemeTheme1 ( $xmlWordThemeTheme)
void setXmlWordWebSettings ( $xmlWordWebSettings)
string __toString ()
Variables
static int $intIdWord (line 93)
  • access: public
static Logger $log (line 100)
  • access: public
static integer $numOL (line 48)
  • access: public
static integer $numUL (line 42)
  • access: public
static string $orderedListStyle (line 55)
  • access: public
static string $PHPDOCXStyles (line 35)
  • access: public
static array $settings = array('w:writeProtection',
'w:view',
'w:zoom',
'w:removePersonalInformation',
'w:removeDateAndTime',
'w:doNotDisplayPageBoundaries',
'w:displayBackgroundShape',
'w:printPostScriptOverText',
'w:printFractionalCharacterWidth',
'w:printFormsData',
'w:embedTrueTypeFonts',
'w:embedSystemFonts',
'w:saveSubsetFonts',
'w:saveFormsData',
'w:mirrorMargins',
'w:alignBordersAndEdges',
'w:bordersDoNotSurroundHeader',
'w:bordersDoNotSurroundFooter',
'w:gutterAtTop',
'w:hideSpellingErrors',
'w:hideGrammaticalErrors',
'w:activeWritingStyle',
'w:proofState',
'w:formsDesign',
'w:attachedTemplate',
'w:linkStyles',
'w:stylePaneFormatFilter',
'w:stylePaneSortMethod',
'w:documentType',
'w:mailMerge',
'w:revisionView',
'w:trackRevisions',
'w:doNotTrackMoves',
'w:doNotTrackFormatting',
'w:documentProtection',
'w:autoFormatOverride',
'w:styleLockTheme',
'w:styleLockQFSet',
'w:defaultTabStop',
'w:autoHyphenation',
'w:consecutiveHyphenLimit',
'w:hyphenationZone',
'w:doNotHyphenateCaps',
'w:showEnvelope',
'w:summaryLength',
'w:clickAndTypeStyle',
'w:defaultTableStyle',
'w:evenAndOddHeaders',
'w:bookFoldRevPrinting',
'w:bookFoldPrinting',
'w:bookFoldPrintingSheets',
'w:drawingGridHorizontalSpacing',
'w:drawingGridVerticalSpacing',
'w:displayHorizontalDrawingGridEvery',
'w:displayVerticalDrawingGridEvery',
'w:doNotUseMarginsForDrawingGridOrigin',
'w:drawingGridHorizontalOrigin',
'w:drawingGridVerticalOrigin',
'w:doNotShadeFormData',
'w:noPunctuationKerning',
'w:characterSpacingControl',
'w:printTwoOnOne',
'w:strictFirstAndLastChars',
'w:noLineBreaksAfter',
'w:noLineBreaksBefore',
'w:savePreviewPicture',
'w:doNotValidateAgainstSchema',
'w:saveInvalidXml',
'w:ignoreMixedContent',
'w:alwaysShowPlaceholderText',
'w:doNotDemarcateInvalidXml',
'w:saveXmlDataOnly',
'w:useXSLTWhenSaving',
'w:saveThroughXslt',
'w:showXMLTags',
'w:alwaysMergeEmptyNamespace',
'w:updateFields',
'w:hdrShapeDefaults',
'w:footnotePr',
'w:endnotePr',
'w:compat',
'w:docVars',
'w:rsids',
'm:mathPr',
'w:uiCompat97To2003',
'w:attachedSchema',
'w:themeFontLang',
'w:clrSchemeMapping',
'w:doNotIncludeSubdocsInStats',
'w:doNotAutoCompressPictures',
'w:forceUpgrade',
'w:captions',
'w:readModeInkLockDown',
'w:smartTagType',
'sl:schemaLibrary',
'w:shapeDefaults',
'w:doNotEmbedSmartTags',
'w:decimalSymbol',
'w:listSeparator'
)
(line 107)
  • access: public
static string $unorderedListStyle (line 62)
  • access: public
array $fileGraphicTemplate (line 68)
  • access: public
string $graphicTemplate (line 86)
  • access: public
Methods
static method docx2txt (line 2435)

Transform a word document to a text file

static void docx2txt ( $from, array $to, [ $options = array()], string $path.)
  • string $path.: Path to the text file output
  • array $to: styles. 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
static method getTempDir (line 3634)

To add support of sys_get_temp_dir for PHP versions under 5.2.1

  • access: public
static string getTempDir ()
Constructor __construct (line 651)

Construct

  • access: public
CreateDocx __construct ([ $baseTemplatePath = PHPDOCX_BASE_TEMPLATE], string $baseTemplatePath.)
  • string $baseTemplatePath.: Optional, basicTemplate.docx as default
  • $baseTemplatePath
Destructor __destruct (line 1422)

Destruct

  • access: public
void __destruct ()
addBreak (line 1811)

Add a break

  • access: public
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
void addBreak ([string $options = array('type' => 'line')])
  • string $options: Values: 'type' (line, page, column)
addChart (line 1886)

Add a chart

  • access: public
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
void addChart ([array $options = array()])
  • array $options: Values: 'color' (1, 2, 3...) color scheme, 'perspective' (20, 30...), 'rotX' (20, 30...), 'rotY' (20, 30...), 'data' (array of values), 'float' (left, right, center) floating image. It only applies if textWrap is not inline (default value). 'font' (Arial, Times New Roman...), 'groupBar' (clustered, stacked, percentStacked), 'horizontalOffset' (int) given in emus (1cm = 360000 emus) '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)), 'verticalOffset' (int) given in emus (1cm = 360000 emus) 'title', 'type' (barChart, pieChart) 'legendPos' (r, l, t, b, none), 'legendOverlay' (0, 1), 'border' (0, 1), 'haxLabel' horizontal axis label, 'vaxLabel' vertical axis label, 'showtable' (0, 1) shows the table of values, 'vaxLabelDisplay' (rotated, vertical, horizontal), 'haxLabelDisplay' (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' (0,1) shows the values inside the chart 'showCategory' (0,1) shows the category inside the chart
addImage (line 1984)

Add an image

  • access: public
  • example: example not found
  • example: example
void addImage ([array $data = ''])
  • array $data: Values: 'border'(int) 1, 2, 3... 'borderDiscontinuous' (0, 1) 'float' (left, right, center) floating image. It only applies if textWrap is not inline (default value). 'font' (string) Arial, Times New Roman... 'horizontalOffset' (int) given in emus (1cm = 360000 emus). Only applies if there is the image is not floating 'jc' (center, left, right, inside, outside) 'name' (string) path to a local image '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)) 'target' (string): document (default value), defaultHeader, firstHeader, evenHeader, defaultFooter, firstFooter, evenFooter 'verticalOffset' (int) given in emus (1cm = 360000 emus)
addLink (line 2064)

Add a link

  • see: bookmarkName
  • access: public
  • example: example not found
  • example: example
void addLink ( $text, [array $options = array('url' => '', 'font' => '', 'sz' => '', 'color' => '0000ff', 'u' => 'single', )])
  • array $options
  • $text
addList (line 2125)

Add a list

  • access: public
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
void addList (array $data, [array $options = array()])
  • 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 ()
addRawWordML (line 2162)

Add a raw WordML

  • deprecated: See addWordML
  • access: public
void addRawWordML (string $wml)
  • string $wml: WordML to add
addTable (line 2236)

Add a table.

  • access: public
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
void addTable (array $tableData, [array $tableProperties = array()], [array $rowProperties = array()])
  • array $tableData: an array of arrays with the table data organized by rows Each cell content may be a string or array. If the cell contents are in the form of an array its keys and posible values are: 'value' (string) 'rowspan' (int) 'colspan' (int) 'width' (int) in twentieths of a point 'border' (none, single, double, dashed, threeDEngrave, threeDEmboss, outset, inset) 'border_color' (ffffff, ff0000) 'border_spacing' (0, 1, 2...) 'border_sz' (10, 11...) in eights of a point 'border_<side>' (none, single, double, dashed, threeDEngrave, threeDEmboss, outset, inset) where the side may be: top, left, right or bottom 'border_<side>_color' (ffffff, ff0000) 'border_<side>_spacing' (0, 1, 2...) 'border_<side>_sz' (10, 11...) 'background_color' (ffffff, ff0000) 'noWrap' (boolean) 'cellMargin' (mixed) an integer value or an array: 'top' (int) in twentieths of a point 'right' (int) in twentieths of a point 'bottom' (int) in twentieths of a point 'left' (int) in twentieths of a point 'textDirection' (string) available values are: tbRl and btLr 'fitText' (boolean) if true fits the text to the size of the cell 'vAlign' (string) vertical align of text: top, center, both or bottom
  • array $tableProperties: Parameters to use Values: 'border' (none, single, double, dashed, threeDEngrave, threeDEmboss, outset, inset) 'border_color' (ffffff, ff0000) 'border_spacing' (0, 1, 2...) 'border_sz' (10, 11...) in eights of a point 'border_settings' (all, outside, inside) if all (default value) the border styles apply to all table borders. If the value is set to outside or inside the border styles will only apply to the outside or inside boreders respectively. 'cantSplitRows' (boolean) set global row split properties (can be overriden by rowProperties) 'cellMargin' (array) the keys are top, right, bottom and left and the values is given in twips (twentieths of a point) 'cellSpacing' (int) given in twips (twentieths of a point) 'float' (array) with the following keys and values: 'textMargin_top' (int) in twentieths of a point 'textMargin_right' (int) in twentieths of a point 'textMargin_bottom' (int) in twentieths of a point 'textMargin_left' (int) in twentieths of a point 'align' (string) posible values are: left, center, right, outside, inside 'font' (Arial, Times New Roman...) 'indent' (int) given in twips (twentieths of a point) 'jc' (center, left, right) 'decimalTab' 'size_col': column width fix (int) column width variable (array) 'tableWidth' (array) its posible keys and values are: 'type' (pct, dxa) pct if the value refers to percentage and dxa if the value is given in twentieths of a point (twips) 'value' (int) 'TBLSTYLEval' (string) Word table style
  • array $rowProperties: (array) a cero based array. Each entry is an array with keys and values: 'cantSplit' (boolean) 'minHeight' (int) in twentieths of a point 'height' (int) in twentieths of a point 'tblHeader' (boolean) if true this row repeats at the beguinning of each new page
addText (line 2300)

Add a text

  • access: public
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example not found
  • example: example
  • example: example
  • example: example
void addText (mixed $textParams, [array $paragraphParams = array()])
  • mixed $textParams: if a string just the text to be included, if an array is or an array of arrays with each element containing the text to be inserted and their formatting properties Array values: 'text' (string) the run of text to be inserted 'b' (on, off) 'caps' (on, off) display text in capital letters 'color' (ffffff, ff0000...) 'columnBreak' (before, after, both) inserts a column break before, after or both, a run of text '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...) 'tab' (boolean) inserts a tab. Default value is false 'spaces': number of spaces at the beguinning of the run of text '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) 'caps' (on, off) display text in capital letters 'color' (ffffff, ff0000...) 'contextualSpacing' (on, off) ignore spacing above and below when using identical styles 'font' (Arial, Times New Roman...) 'i' (on, off) 'indent_left' 100..., 'indent_right' 100... 'jc' (both, center, distribute, left, right) 'keepLines' (on, off) keep all paragraph lines on the same page 'keepNext' (on, off) keep in the same page the current paragraph with next paragraph 'lineSpacing' 120, 240 (standard), 360, 480, ... 'pageBreakBefore' (on, off) 'spacingBottom' (int) bottom margin in twentieths of a point 'spacingTop' (int) top margin in twentieths of a point 'sz' (8, 9, 10, ...) size in points 'tabPositions' (array) each entry is an associative array with the following keys and values 'type' (string) can be clear, left (default), center, right, decimal, bar and num 'leader' (string) can be none (default), dot, hyphen, underscore, heavy and middleDot 'position' (int) given in twentieths of a point if there is a tab and the tabPositions array is not defined the standard tab position (default of 708) will be used 'textDirection' (lrTb, tbRl, btLr, lrTbV, tbRlV, tbLrV) text flow direction 'u' (none, dash, dotted, double, single, wave, words) 'widowControl' (on, off)
createDocx (line 2320)

Generate a new DOCX file

  • access: public
  • example: example not found
  • example: example
void createDocx (string $args[0], string $args[1])
  • 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)
getExtension (line 1454)

Getter

  • access: public
void getExtension ()
getTemporaryDirectory (line 1473)

Getter

  • access: public
void getTemporaryDirectory ()
getXmlContentTypes (line 1493)

Getter

  • access: public
void getXmlContentTypes ()
getXmlDocPropsApp (line 1533)

Getter

  • access: public
void getXmlDocPropsApp ()
getXmlDocPropsCore (line 1553)

Getter

  • access: public
void getXmlDocPropsCore ()
getXmlDocPropsCustom (line 1573)

Getter

  • access: public
void getXmlDocPropsCustom ()
getXmlRelsRels (line 1513)

Getter

  • access: public
void getXmlRelsRels ()
getXmlWordDocumentContent (line 1593)

Getter

  • access: public
void getXmlWordDocumentContent ()
getXmlWordDocumentStyles (line 1613)

Getter

  • access: public
void getXmlWordDocumentStyles ()
getXmlWordEndnotes (line 1633)

Getter

  • access: public
void getXmlWordEndnotes ()
getXmlWordFontTable (line 1653)

Getter

  • access: public
void getXmlWordFontTable ()
getXmlWordFooter1 (line 1673)

Getter

  • access: public
void getXmlWordFooter1 ()
getXmlWordHeader1 (line 1693)

Getter

  • access: public
void getXmlWordHeader1 ()
getXmlWordRelsDocumentRels (line 1713)

Getter

  • access: public
void getXmlWordRelsDocumentRels ()
getXmlWordSettings (line 1733)

Getter

  • access: public
void getXmlWordSettings ()
getXmlWordStyles (line 1753)

Getter

  • access: public
void getXmlWordStyles ()
getXmlWordThemeTheme1 (line 1773)

Getter

  • access: public
void getXmlWordThemeTheme1 ()
getXml_Word_WebSettings (line 1793)

Setter

  • access: public
void getXml_Word_WebSettings ()
setEncodeUTF8 (line 2661)

Transform to UTF-8 charset

  • access: public
void setEncodeUTF8 ()
setExtension (line 1444)

Setter

  • access: public
void setExtension ( $extension)
  • $extension
setLanguage (line 2672)

Change default language.

void setLanguage ([$lang $lang = null])
  • $lang $lang: Locale: en-US, es-ES...
setTemporaryDirectory (line 1463)

Setter

  • access: public
void setTemporaryDirectory ( $tempDir)
  • $tempDir
setXmlContentTypes (line 1483)

Setter

  • access: public
void setXmlContentTypes ( $xmlContentTypes)
  • $xmlContentTypes
setXmlDocPropsApp (line 1523)

Setter

  • access: public
void setXmlDocPropsApp ( $xmlDocPropsApp)
  • $xmlDocPropsApp
setXmlDocPropsCore (line 1543)

Setter

  • access: public
void setXmlDocPropsCore ( $xmlDocPropsCore)
  • $xmlDocPropsCore
setXmlDocPropsCustom (line 1563)

Setter

  • access: public
void setXmlDocPropsCustom ( $xmlDocPropsCustom)
  • $xmlDocPropsCustom
setXmlRelsRels (line 1503)

Setter

  • access: public
void setXmlRelsRels ( $xmlRelsRels)
  • $xmlRelsRels
setXmlWordDocument (line 1583)

Setter

  • access: public
void setXmlWordDocument ( $xmlWordDocument)
  • $xmlWordDocument
setXmlWordDocumentStyles (line 1603)

Setter

  • access: public
void setXmlWordDocumentStyles ( $xmlWordDocumentStyles)
  • $xmlWordDocumentStyles
setXmlWordEndnotes (line 1623)

Setter

  • access: public
void setXmlWordEndnotes ( $xmlWordEndnotes)
  • $xmlWordEndnotes
setXmlWordFontTable (line 1643)

Setter

  • access: public
void setXmlWordFontTable ( $xmlWordFontTable)
  • $xmlWordFontTable
setXmlWordFooter1 (line 1663)

Setter

  • access: public
void setXmlWordFooter1 ( $xmlWordFooter)
  • $xmlWordFooter
setXmlWordHeader1 (line 1683)

Setter

  • access: public
void setXmlWordHeader1 ( $xmlWordHeader)
  • $xmlWordHeader
setXmlWordRelsDocumentRels (line 1703)

Setter

  • access: public
void setXmlWordRelsDocumentRels ( $xmlWordRelsDocumentRels)
  • $xmlWordRelsDocumentRels
setXmlWordSettings (line 1723)

Setter

  • access: public
void setXmlWordSettings ( $xmlWordSettings)
  • $xmlWordSettings
setXmlWordStyles (line 1743)

Setter

  • access: public
void setXmlWordStyles ( $xmlWordStyles)
  • $xmlWordStyles
setXmlWordThemeTheme1 (line 1763)

Setter

  • access: public
void setXmlWordThemeTheme1 ( $xmlWordThemeTheme)
  • $xmlWordThemeTheme
setXmlWordWebSettings (line 1783)

Setter

  • access: public
void setXmlWordWebSettings ( $xmlWordWebSettings)
  • $xmlWordWebSettings
__toString (line 1433)

Magic method, returns current word XML

  • return: Return current word
  • access: public
string __toString ()
Class Constants
NAMESPACEWORD = 'w' (line 23)
SCHEMA_IMAGEDOCUMENT =
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'
(line 24)
SCHEMA_OFFICEDOCUMENT =
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'
(line 26)

Documentation generated on Tue, 21 May 2013 17:19:47 +0200 by phpDocumentor 1.4.4