- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- docxSettings
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
pdx:acceptTracking
Accepts tracked contents or styles.
Description
Attributes and sub-elements
referenceNode
key | Description |
---|---|
type | * (all, default value), bookmark, break, chart, endnote (content reference), footnote (content reference), image, paragraph (also for links and lists), section, shape, table. |
contains | Contains a text string. |
occurrence | Exact occurrence or range of contents (e.g.: 2..9, 2.., ..9) (string) or first() or last(). If empty iterate all elements. |
attribute | Contains a specific attribute key and value. |
parent | Main document body as default, allows to set any parent or a specific one. w:body (default), '/' (any parent) or any other specific parent (/w:tbl/, /w:tc/, /w:r/...). |
customQuery | Custom xpath query, overwrites any other reference. |
Code samples
#Example 1
config.xml
content.xml
12
1
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main" >
3
<pdx:content>
4
<pdx:acceptTracking>
5
<pdx:referenceNode pdx:type="paragraph" pdx:contains="www.phpdocx.com" />
6
</pdx:acceptTracking>
7
<pdx:acceptTracking>
8
<pdx:referenceNode pdx:type="paragraph" pdx:contains="phpdocx is a library" />
9
</pdx:acceptTracking>
10
</pdx:content>
11
</pdx:document>
12
settings.xml
10
1
import os as os
2
import sys as sys
3
sys.path.append(os.path.abspath("wrappers/python/XmlDocx"))
4
import XmlDocx as XmlDocx
5
document = XmlDocx.XmlDocx("config.xml")
6
document.setDocumentProperties("settings.xml")
7
document.addContent("content.xml")
8
document.setXmlDocxPath("xmldocx path")
9
document.render()
10