pdx:docxSettings

Modifies the general Word settings.

Description

Element definition

x
 
1
<pdx:settings>
2
    <pdx:docxSettings>
3
        <pdx:autoHyphenation pdx:value="" />
4
        <pdx:bookFoldPrinting pdx:value="" />
5
        <pdx:bookFoldPrintingSheets pdx:value="" />
6
        <pdx:bookFoldRevPrinting pdx:value="" />
7
        <pdx:bordersDoNotSurroundHeader pdx:value="" />
8
        <pdx:bordersDoNotSurroundFoote pdx:value="" />
9
        <pdx:consecutiveHyphenLimit pdx:value="" />
10
        <pdx:defaultTableStyle pdx:value="" />
11
        <pdx:defaultTabStop pdx:value="" />
12
        <pdx:documentType pdx:value="" />
13
        <pdx:doNotHyphenateCaps pdx:value="" />
14
        <pdx:doNotShadeFormData pdx:value="" />
15
        <pdx:gutterAtTop pdx:value="" />
16
        <pdx:hideGrammaticalErrors pdx:value="" />
17
        <pdx:hideSpellingErrors pdx:value="" />
18
        <pdx:hyphenationZone pdx:value="" />
19
        <pdx:mirrorMargins pdx:value="" />
20
        <pdx:noPunctuationKerning pdx:value="" />
21
        <pdx:printTwoOnOne pdx:value="" />
22
        <pdx:savePreviewPicture pdx:value="" />
23
        <pdx:trackRevisions pdx:value="" />
24
        <pdx:updateFields pdx:value="" />
25
        <pdx:view pdx:value="" />
26
        <pdx:zoom pdx:value="" />
27
        <pdx:customSettings>
28
            <pdx:customSetting pdx:tag="">
29
                <pdx:attribute pdx:name="">value</pdx:attribute>
30
                <pdx:attribute pdx:name="">value</pdx:attribute>
31
            </pdx:customSetting>
32
        </pdx:customSettings>
33
        <pdx:compat>
34
            <pdx:attribute pdx:name="">value</pdx:attribute>
35
            <pdx:attribute pdx:name="">value</pdx:attribute>
36
        </pdx:compat>
37
    </pdx:docxSettings>
38
</pdx:settings>
39

With the help of this element you can set, among many others:

  • The way the Word document will print.
  • The view mode and zoom of the Word document at openning.
  • To hide or show grammatical and/or spelling errors.
  • To track or not revisions.
  • The document type.
  • Hyphenation settings.
  • Default table style and tab positioning.
  • Etcetera.

If you need to alter the setting of pre-existing Word documents you may use the modifyDocxSettings element available in the DocxUtilities package.

Code samples
#Example 1

config.xml

7
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:config>
4
        <pdx:output pdx:name="output" pdx:type="docx" />
5
    </pdx:config>
6
</pdx:document>
7

content.xml

13
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:content>
4
        <pdx:addText>
5
            <pdx:textRun>
6
                <pdx:data pdx:dataId="" pdx:dataType="text">In this case we set the view mode as "outline" and the default zoom on openning to 70%.</pdx:data>
7
                <pdx:textRunStyle>
8
                </pdx:textRunStyle>
9
            </pdx:textRun>
10
        </pdx:addText>
11
    </pdx:content>
12
</pdx:document>
13

settings.xml

10
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:settings>
4
        <pdx:docxSettings>
5
            <pdx:view pdx:value="outline" />
6
            <pdx:zoom pdx:value="70" />
7
        </pdx:docxSettings>
8
    </pdx:settings>
9
</pdx:document>
10
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

The resulting Word document looks like: