pdx:createListStyle

Creates a custom list style to use it in combination with the addList and embedHTML methods.

Description

Element definition

x
 
1
<pdx:settings>
2
    <pdx:createListStyle pdx:name="">
3
        <pdx:item pdx:type="" pdx:font="" pdx:fontSize="" pdx:format="" pdx:hanging="" pdx:left="" pdx:start="" />
4
    </pdx:createListStyle>
5
</pdx:settings>
6

This element allows the generation of custom list styles that can be used in combination with the addList and embedHTML methods.

if you want that the embedded HTML code uses the generated list style this has to have the same name as the corresponding CSS class for the UL tag. Do not forget to set the option 'customListStyles' to true in your call to embedHTML.

Attributes and sub-elements

name

The name of the list we are creating. If used in combination with the embedHTML or replaceTemplateVariableByHTML elemnts the neme given to the new custom list has to coincide with the list style name that we want to override.

options

key Description
type
  • none
  • bullet
  • decimal
  • upperRoman
  • lowerRoman
  • upperLetter
  • lowerLater
  • ordinal
  • cardinalText
  • ordinalText
bold If true use bold characters.
color Hexadecimal color value: 'FF0000', '000000', ...
font Font family. This allows the customization of bullets.
fontSize Font size in points.
format The default one is '%1.' for first level, '%2' for second level and so long so forth.
hanging The extra space for the numbering, should be big enough to accommodate it, the default is 360.
italic If true use italics.
left The left indent. The default value is 720 times the list level.
start Start value. The default value is 1.
underline Underlines. Possible values are: single, words, double, dotted, dash and wave.
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

15
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<pdx:document xmlns:pdx="http://www.phpdocx.com/main">
3
    <pdx:content>
4
        <pdx:addList pdx:listType="latin">
5
            <pdx:data pdx:type="list">
6
                <pdx:item pdx:depth="1">item 1</pdx:item>
7
                <pdx:item pdx:depth="2">subitem 1.1</pdx:item>
8
                <pdx:item pdx:depth="2">subitem 1.2</pdx:item>
9
                <pdx:item pdx:depth="2">subitem 1.3</pdx:item>
10
                <pdx:item pdx:depth="1">item 2</pdx:item>
11
            </pdx:data>
12
        </pdx:addList>
13
    </pdx:content>
14
</pdx:document>
15

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:createListStyle pdx:name="latin">
5
            <pdx:item pdx:type="lowerLetter" pdx:format="%1." />
6
            <pdx:item pdx:type="lowerRoman" pdx:format="%1.%2." />
7
        </pdx:createListStyle>
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: