addTableFigures
- addBibliography
- addBookmark
- addBreak
- addCaption
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableAuthorities
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
addTableFigures

Inserts a Table of Figures into the Word document.
Description
public addTableFigures ( [array $options [, array $legend]] )
This method allows you to include a Table of Figures in the Word document.
Parameters
options
The possible keys and values are:
Key | Type | Description |
---|---|---|
autoUpdate | boolean | If true it will try to update the content when first opened. |
scope | string | Contents to display: table (default), figure and other custom values based on the content style ID. |
legend
The possible keys and values are:
Key | Type | Description |
---|---|---|
text | array | The placeholder text that will be shown if the autoupdate option is not activated. |
Code samples
x
1
require_once 'classes/CreateDocx.php';
2
3
$docx = new CreateDocx();
4
5
$docx->addText('Table of Figures', array('bold' => true, 'fontSize' => 14));
6
$legend = array(
7
'text' => 'Click here to update the table of figures',
8
'color' => 'B70000',
9
'bold' => true,
10
'fontSize' => 12,
11
);
12
$docx->addTableFigures(array('autoUpdate' => true, 'scope' => 'Table'), $legend);
13
14
$docx->addText('Table of Figures', array('bold' => true, 'fontSize' => 14));
15
$legend = array(
16
'text' => 'Click here to update the table of figures',
17
'fontSize' => 11,
18
);
19
$docx->addTableFigures(array('autoUpdate' => true, 'scope' => 'Figure'), $legend);
20
21
$valuesTable = array(
22
array(
23
11,
24
12,
25
13,
26
14
27
),
28
array(
29
21,
30
22,
31
23,
32
24
33
),
34
array(
35
31,
36
32,
37
33,
38
34
39
),
40
41
);
42
43
$paramsTable = array(
44
'border' => 'single',
45
'tableAlign' => 'center',
46
'borderWidth' => 10,
47
'borderColor' => 'B70000',
48
'textProperties' => array('bold' => true, 'font' => 'Algerian', 'fontSize' => 18),
49
'caption' => array('showLabel' => true, 'text' => ' Sample Table', 'align' => 'right', 'styleName' => 'Table'),
50
);
51
52
$docx->addTable($valuesTable, $paramsTable);
53
54
$options = array(
55
'src' => 'image.png',
56
'imageAlign' => 'center',
57
'scaling' => 50,
58
'spacingTop' => 10,
59
'spacingBottom' => 0,
60
'spacingLeft' => 0,
61
'spacingRight' => 20,
62
'textWrap' => 0,
63
'borderStyle' => 'lgDash',
64
'borderWidth' => 6,
65
'borderColor' => 'FF0000',
66
'caption' => array('showLabel' => false, 'text' => ' Sample Image 2', 'styleName' => 'Figure')
67
);
68
69
$docx->addImage($options);
70
71
$options = array(
72
'src' => 'image.png',
73
'imageAlign' => 'center',
74
'scaling' => 50,
75
'spacingTop' => 10,
76
'spacingBottom' => 0,
77
'spacingLeft' => 0,
78
'spacingRight' => 20,
79
'textWrap' => 0,
80
'borderStyle' => 'lgDash',
81
'borderWidth' => 6,
82
'borderColor' => 'FF0000',
83
'caption' => array('showLabel' => false, 'text' => ' Sample Image 2', 'styleName' => 'Figure')
84
);
85
86
$docx->addImage($options);
87
88
$docx->createDocx('output');
89
Release notes
- phpdocx 10.0:
- new method.