pdx:setLanguage

Sets the default language of the Word document.

Description

Element definition

x
 
1
<pdx:settings>
2
    <pdx:setLanguage pdx:value="" />
3
</pdx:settings>
4

Sets the default language for the whole Word document.

This is important for grammar and spell checking in the Word interface.

Attributes and sub-elements

value

The language-country ISO codes: en-US, es-ES.

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

20
 
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">Este texto está en español y no debería estar marcado si se utiliza el corrector ortográfico.</pdx:data>
7
                <pdx:textRunStyle>
8
                </pdx:textRunStyle>
9
            </pdx:textRun>
10
        </pdx:addText>
11
        <pdx:addText>
12
            <pdx:textRun>
13
                <pdx:data pdx:dataId="" pdx:dataType="text">Now in english.</pdx:data>
14
                <pdx:textRunStyle>
15
                </pdx:textRunStyle>
16
            </pdx:textRun>
17
        </pdx:addText>
18
    </pdx:content>
19
</pdx:document>
20

settings.xml

7
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:settings>
4
        <pdx:setLanguage pdx:value="es-ES" />
5
    </pdx:settings>
6
</pdx:document>
7
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: