replaceChartData
- addBibliography
- addBookmark
- addBreak
- 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
- 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
- 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
replaceChartData
![](/img/preview/methods_check.png)
![](/img/preview/methods_X.png)
Replaces the data associated with a given chart (titles, categories, legends, sections and values).
This method allows to replace the chart data in an existing Word document. You may fully customize the chart via the Word interface before inserting the real data with the help of phpdocx.
The chart type to be updated must be supported by addChart. Extended charts are not supported.
source
Path to the DOCX.
target
Path to the resulting DOCX.
data
The keys are the numbers of the charts to replace and the values are arrays of data as described in the addChart method.
Error while trying to open the (base) template as a zip file.
The index chart does not exist.
Example #1
- phpdocx 14.0:
- return DOCXStructure.
- phpdocx 13.5:
- DOCXStructure and in-memory DOCX documents.
- phpdocx 12.0:
- use the default temp folder to generate XLSX files.
- phpdocx 8.0:
- add editable XLSX.
- phpdocx 7.0:
- improved to support titles, legends and categories.