Microsoft Word DOCX – Export Config
This document explains how to configure PageSeeder to create a .docx format file from PSML source documents. It is companion technology to the Import Microsoft Word DOCX config usage.
A copy of the default Word export config is available for reference, see the default config example.
Other useful information regarding the docx integration with PageSeeder is available:
- In-progress document Word DOCX - export schema reference, and
- Export Microsoft Word docx Ant task.
Overview
The Microsoft Word Export Config (word-export-config.xml
) together with the Word Export Template (word-export-template.dotx
) allow PSML data to be converted into the docx format for use with common tools such as Microsoft Word, Google Docs and publishing tools such as Adobe InDesign.
Usage
There are two ways to customize the default config, users can modify it for their own use:
- Sign in to PageSeeder and select a project or group.
- Select Enable developer mode under Account menu > Preferences.
- To change the config for yourself ONLY (This is available to project managers and administrators only), go to a document, click the rocket icon in the right sidebar (or from Documents page, under the ellipsis to the right of a document), then Create DocX, +Show more options, then Edit config,
- The Member publish configurations page only has one row and applies to all types.
Alternately, the configuration can be changed for every member of the group:
- This is available to project managers and administrators only, click Project administration menu > Template > Template configuration, note the options under the Publication types table in the Word export column,
- To change the configuration for all documents, select override under the default option in the default row.
- To revert to the default config, select delete under the edit option in the default row.
- To change the configuration for a specific publication type, click create under Word export column in the row for that type.
When editing this config file in PageSeeder, pressing ctrl-space displays autocomplete options to make editing easier.
Word export template file
By design, the content of PageSeeder documents has no formatting information attached. As a commonly available, widely-understood tool for formatting documents, Word is an ideal complement to PageSeeder.
Used in this way, the formatting instructions are stored in a Word template, which is essentially nothing more than a Word document with all the styles you want to use applied to some text. Because the template is a standard Word document, people familiar with Word can set up the formatting using an application they are comfortable with, instead of having to learn something new.
The only challenge with this model is telling PageSeeder how to map the PSML into the Word styles. Understanding the options for this is the subject of this document. It starts by knowing that “styles” can be applied to:
- Characters – equivalent to an inline label.
- Paragraphs – equivalent to a block label.
- Tables – can be categorized in PageSeeder by the use of the @role attribute.
- Lists – can be categorized in PageSeeder by the use of the
@role
attribute on <list> or <nlist>.
The location of the default docx template for a project is:
WEB-INF/config/template/[project-name]/publication/default/ word-export-template.docx
To customize the Word template, first download the default template from your project on PageSeeder—click the wrench icon in the header bar, then in the main section, click Project administration menu > Template > Template configuration, then in the Publication types table, Template column and in the default row, click default.
Modify the styles in Word and save the changes. Then, as outlined above, in the Template column, click upload in the default row (or publication type row).
The Word Export process must have bullet and numbered list styles properly configured. The default template can act as a reference, but users that are not familiar with list styles in Word will find it easier to modify the already-configured default template than to configure their existing Word template. The steps for creating a new list style are:
- Create a new paragraph style for each level of the list, for example
My List 1
,My List 2
. - Select Define New List Style from the Multilevel List menu (not Define New Multilevel List).
- Enter a name, for example
My List
(which you will use in the export config) then select Numbering from the Format menu and define the numbering options for each level. - Click More and link the correct paragraph style to each level.
Word export config file
The location of the default export config for a project is:
WEB-INF/config/template/[project-name]/publication/default/ word-export-config.xml
The information below describes different ways that the export config file transforms PSML into DOCX format.
Word allows styles to have multiple names, separated by commas. When configuring the export, use only the name before the first comma. For example, reference this style My heading,Special
as follows:
<level value="1" wordstyle="My heading" >
- Only styles that are actually used in the template can be referenced.
- Word's built in heading styles are special case and must be referenced using lower case, for example
wordstyle="heading 1"
. - Sometimes other style names in DOCX are actually lower case, even though they are displayed with capitals, so if a style is not being applied, try changing the reference to lower case.
<core>
The element defines how to populate the properties of a Word file from PageSeeder. To see the properties of a docx file, click the Info option under the File menu in Word.
<core> <creator select="[ps-current-user]" /> <description select="[ps-document-description]" /> <title select="[ps-document-title]" /> <!-- <modified select="[ps-document-modified]" /> --> <created select="[ps-current-date]" /> <keywordsselect="[ps-document-labels]" /> <subject select="" /> <category select="" /> <version select="1.0" /> <revision select="1" /> </core>
The export only uses these values when ‘Config’ is selected in the Document publish panel, in the Choose Word core attributes field, or the manual-core parameter is set to Config
. The export resolves PageSeeder content into the Word property fields according to the use of the following token values for the @select
attributes above.
Token | PageSeeder content |
---|---|
[ps-current-user] | The full name of the current user (requires current-user parameter on export task) |
[ps-document-description] | The PSML document description |
[ps-document-title] | The PSML document title |
[ps-document-created] | The PSML document created date |
[ps-document-modified] | The PSML document modified date |
[ps-current-date] | The current date |
[ps-document-labels] | The PSML document labels |
Three options are available for the Word core attributes field:
- Values come from the panel (default option) –
manual-core
value="Manual"
. - Values under
<core>
in the export config are used –manual-core
value="Config"
. - Values in the export template are used –
manual-core
value="Template"
.
Each of the elements below maps to a Word core attribute as follows:
<creator select="PageSeeder" />
<creator>
maps to the Author property in Word.
<description select="PageSeeder" />
<description>
maps to the Comment property in Word.
<subject select="PageSeeder Document" />
<subject>
maps to the Subject property in Word.
<title select="Default Title" />
<title>
maps to the Title property in Word.
<category select="No Category" />
<category>
maps to the Category property in Word.
<version select="1.0" />
<version>
maps to the Version property which is not visible in Word unless the template has a custom property namedVersion
. This can be added in Word under Info > Properties > Advanced Properties > Custom. Requires pso-docx version0.8.21
or higher.
<revision select="1" />
<revision>
maps to the Revision property in Word which is not visible in Word.
<toc> (Table of Contents)
<toc generate="true" style="TOC2" > <!-- range from 1 up to 9 --> <headings generate="false" select="1-9" /> <!-- range from 1 up to 9 --> <outline generate="true" select="1-9" /> <paragraph generate="false"> <style value="[word style]" indent="[indent level]" /> <!-- any paragraph style defined in the document with the corresponding TOC indent level --> </paragraph> </toc>
Element <toc>
in PSML is not transformed. It acts as a placeholder for where to insert the Table of Contents field in the exported docx file.
Word can generate a Table of Contents (ToC) using any of the following types of objects. The elements must be in this order:
<outline>
– generate ToC from any styles with outline levels (for example the built in Word heading styles) by setting the@generate
attribute of<outline>
totrue
. The value of the@select
attribute can be an integer range from 1 to 9.
<outline generate="true" select="3-6" />
<paragraph>
– generate ToC from specified paragraph styles by setting the@generate
attribute of<paragraph>
totrue
. Any other value won’t generate a ToC. The<paragraph>
element contains<style>
elements, each with a unique@value
attribute that declares which paragraph styles generate the ToC. An@indent
attribute sets the level for the paragraph style in the ToC hierarchy.
<paragraph generate="false"> <style value="Heading 1" indent="1" /> <style value="Heading 2" indent="2" /> <!-- any paragraph style defined in the document with the corresponding ToC indent level --> </paragraph>
- Default behavior – by default, all heading levels are added to the ToC using outline level and the value of the
@generate
attribute on the<paragraph>
element is set tofalse
.
As of pso-docx version 0.8.28
or higher:
- The
<toc>
element under<config>
relates to ToC generation in the root (top-level) document. - The
<toc>
element can also appear under<elements>
where it relates to ToC generation in non-root documents and can be used to generate multiple ToCs which will only display items from within the scope of that document plus its embedded content. - The
<headings>
element under<toc>
is deprecated, use<outline>
instead.
<default>
This element is where the default conversion options are set.
<default> <defaultparagraphstyle wordstyle="Body Text" /> <defaultcharacterstyle wordstyle="Default Paragraph Font" /> <comments generate="false" /> <mathml generate="false" /> <citations documenttype="bibliography" pageslabel="pages" /> <endnotes documenttype="endnotes" /> <footnotes documenttype="footnotes" /> <xrefs hyperlinkstyle="PS Hyperlink" referencestyle="PS Reference" /> <placeholders resolvedstyle="PS Placeholder" unresolvedstyle="PS Unresolved" /> <indexdoc documentlabel="indexdoc" columns="2" /> </default>
Following elements are all optional:
<defaultparagraphstyle>
– where a<block>
is not specifically mapped to a style name in the DOCX file, it is transformed to a default style, usuallyBody Text
, but it can be the name of any style that exists in the Word Export Template. Where the DOCX file doesn’t have a style that matches, the default style is set toNormal.
This has no effect ifblock/@default
described below is set.
<defaultparagraphstyle style="Body Text"/>
<defaultcharacterstyle>
– defines which style is applied to all inline elements that don’t have specific mapping to a style. The default value isDefault Paragraph Font
.<defaultcharacterstyle>
can be any Word Character Style Name that exists in the Word Export Template. If a style is used that doesn’t exist in this template, Word, by default, resets the value. This has no effect ifinline/@default
described below is set.
<defaultcharacterstyle style="Default Paragraph Font"/>
<comments>
– the<comments>
element is used to add a comment to each fragment with a link to add comments to PageSeeder by the users’ default email application. By default, this value is set tofalse
.
<comments generate="false"/>
<mathml>
– converts any Math ML object that is referenced by the exported psml document. These are converted back to Open Office math ml objects in Word. By default, this value is set tofalse
.
<mathml generate="false"/>
<citations>
– xrefs to properties fragments in a document with type@documenttype
become DOCX citations and a DOCX bibliography is inserted after this document’s<section id="title">
content. If there is an inline label@pageslabel
directly after the xref, its content becomes the citation page or page range (e.g.<xref documenttype="bibliography" ... >...</xref><inline label="pages">10 - 20</inline>
). Requires additional post-processing and pso-docx version0.7.4
or higher.
<citations documenttype="bibliography" pageslabel="pages" />
<endnotes>
– xrefs to fragments under<section id="content">
in a document with type@documenttype
become DOCX endnotes. The xrefs must have@type="alternate"
and the document must be generated usingps:process
ANT task wherexrefs
/@types
includesalternate
. Requires pso-docx version0.8.1
or higher.
<endnotes documenttype="endnotes"/>
<footnotes>
– xrefs to fragments under<section id="content">
in a document with type@documenttype
become DOCXfootnotes
. The xrefs must have@type="alternate"
and the document must be generated usingps:process
ANT task wherexrefs
/@types
includesalternate
. Requires pso-docx version0.8.1
or higher.
<footnotes documenttype="footnotes"/>
<xrefs>
– iftype="cross-reference"
then xrefs become DOCXREF
instead ofHYPERLINK
.REF
has an ‘Update field’ option in Word that means pointers to numbered paragraphs or headings can be updated to reflect any numbering changes. This isn’t possible with theHYPERLINK
option.
As of version0.7.0
, xrefs with@display="template"
and@title
containing{parentnumber}
or{prefix}
become DOCXREF
even without setting@type
above. Also<xrefs>
can have the following attributes:@hyperlinkstyle
: The Word style for xrefs pointing outside the document (defaultPS Hyperlink
).@referencestyle
: The Word style for xrefs pointing within the document (defaultPS Reference
).
<xrefs type="cross-reference" hyperlinkstyle="My Hyperlink" referencestyle="My Reference" />
For further information on configuring xrefs for DOCX, see <xref>.
<placeholders>
– defines the word styles for PSML<placeholder>
elements. Requires pso-docx version0.8.8
or higher. It can have the following attributes:@resolvedstyle
: The Word style for resolved placeholders (defaultDefaultParagraphFont
).@unresolvedstyle
: The Word style for unresolved placeholders - no corresponding metadata property (defaultDefaultParagraphFont
).
<placeholders resolvedstyle="My Placeholder" unresolvedstyle="My Unresolved" />
<indexdoc>
– defines an index document where a DOCX index is inserted after the document’s<section id="title">
content. See <inline> for how to insert index entries. Requires pso-docx version0.8.20
or higher. It can have the following attributes:@documentlabel
: The label that identifies the index document.@columns
: The number of columns in the index - from 1 to 4 (default2
).
<indexdoc documentlabel="myindex" columns="1" />
In the word-export-template.docx
, only character styles can be used to format hyperlinks, references or placeholders.
<elements>
Groups the options available to PSML elements when transforming from PSML to DOCX. These include:
<document>
<block>
<image>
<inline>
<properties-fragment>
<table>
<heading>
<para>
<title>
<nlist>
<list>
<preformat>
<xref>
They can be transformed specifically for a document with a certain label. This can be defined by setting the @label
attribute inside a separate <elements>
element.
<elements label="warranty">
If this is set, the options defined under this element only apply to documents with this label. In the example above, the options defined under <elements>
would only apply to elements under a document with label ‘warranty’.
An <elements>
can have a @blocklabel
which means that the options underneath will only apply to PSML elements with that block label as their closest ancestor. Requires pso-docx version 0.8.20
or higher.
<elements blocklabel="info">
An <elements>
can have a @fragmentlabel
which means that the options underneath will only apply to PSML elements when their closest ancestor <fragment>
has @labels
containing this label. Requires pso-docx version 0.8.27
or higher.
<elements fragmentlabel="tip">
- The only options supported under
<elements>
that have@blocklabel
or@fragmentlabel
are<heading>
,<para>
,<list>
and<nlist>
. - Having both
@blocklabel
and@fragmentlabel
on the same<elements>
is not supported. - The
elements/@blocklabel
options will overrideelements/@fragmentlabel
options.
<document>
<config> <elements> <document wordsection="3" /> </elements> <elements label="appendix"> <document wordsection="1" /> </elements> <elements label="landscape"> <document wordsection="2" /> </elements> </config>
<document>
defines which section in the word template each PSML document will use. It must have a @wordsection
attribute that is a number referring to a section in the word-export-template.docx
where 1=first section
, 2=second section
and so on. Requires pso-docx version 0.8.23
or higher.
In the above example:
- The third section in the template is the default for all PSML documents.
- PSML documents with the document label
appendix
will use the first section. - PSML documents with the document label
landscape
will use the second section.
When no word section number is defined the first section in the template is used by default.
<block>
<block default="generate-ps-style"> <label value="Abstract" wordstyle="Instructions" /> <label value="Prompt" wordstyle="Prompt" /> <label value="Tip" wordstyle="generate-ps-style" > <keep-paragraph-with-next /> </label> <ignore label="Notes" /> </block>
<block>
element contains the handling of all <block>
elements. The @default
attribute is used to define what Paragraph Style is applied to any <block>
elements that have no transformation. It accepts two values:
generate-ps-style
– is used to generate a word style for each of the labels found. It generates a Word Paragraph Style namedps_blk_[name-of-label]
.- A specific Word Style name that will be used as the default.
Under <block>
, two elements are valid and must be in this order:
<label>
– then the contents inside this block are transformed into the Word Style declared as the value of the attribute@wordstyle
.The attribute@wordstyle
under<label>
can also containgenerate-ps-style
forcing the process to generate a unique style for that block label. The<keep-paragraph-with-next/>
element can be used to keep this on the same line as the next content (also known as Style separator).<ignore>
– means the content inside this block won’t be transformed on export.
Using <ignore>
or <label>
even under <elements>
with @label
will disable generate-ps-style
for that block label on all documents.
<image>
Contains style for <image>
elements. Since images are inline objects in PageSeeder the @wordstyle
must correspond to a character style in DOCX (not a paragraph style). Requires pso-docx version 0.8.19
or higher.
An <image>
can also have a @maxwidth
which is the width in pixels that a larger image will be re-sized to (default 620). A @widelabel
can define an image label that allows an image to ignore the max width (can be used for A3 size images for example). Requires pso-docx version 0.8.20
or higher.
<image wordstyle="Image" maxwidth="400" widelabel="big" />
<inline>
<inline default="generate-ps-style" > <label value="Optional" wordstyle="OptionalNormal" /> <ignore label="Notes" /> <tab label="TabLabel" /> <fieldcode label="n" value="LISTNUM LegalDefault \\l 1 \\s 2 " /> <index label="ind" /> </inline>
<inline>
element contains the handling of all <inline>
elements. @default
attribute is used to define what Paragraph Style is applied to any block elements that have no transformation. It accepts two options: generate-ps-style
and any other value. generate-ps-style
is used to generate a word style for each of the labels found. It generates a Word Character Style named ps_inl_[name-of-label]
. If a specific Word Style name is specified then that will be used as the default.
Under <inline>
, five elements are accepted: <label>
, <ignore>
, <tab>
, <fieldcode>
and <index>
but they must be in this order. <ignore>
is used to define ignored labels on transformation.
Using <ignore>
, <tab>
or <label>
even under <elements>
with @label
will disable generate-ps-style
for that inline label on all documents.
If a label name is defined under the attribute @label
under <ignore>
, then the contents inside this inline won’t be transformed on transformation.
If a label name is defined under the attribute @value
under <label>
, then the contents inside this inline are transformed into the Word Style selected under the attribute @wordstyle
. The attribute @wordstyle
under <label>
can also contain generate-ps-style
forcing the process to generate a unique style for that inline label.
If a label name is defined under the attribute @label
under <tab>
, then the contents inside this inline is transformed to a word tab on output.
If a label name is defined under the attribute @label
under <fieldcode>
, then the contents inside this inline are transformed to a word fieldcode on output. The fieldcode generated is the one set in the @value
attribute.
If a label name is defined under the attribute @label
under <index>
, then the contents inside this inline are transformed to a word index entry where a :
indicates a sub-entry, for example <inline label="ind">speed</inline>
or <inline label="ind">speed:fast</inline>
. The inline label should be directly after the term being indexed with no space in between. Requires pso-docx version 0.8.20
or higher.
<properties-fragments>
<properties-fragments> <properties-fragment tablestyle="Table Grid" titlestyle="PS Table Header" valuestyle="PS Table Body" > <width type="pct" value="100%"/> </properties-fragment> <properties-fragment type="detail" tablestyle="My Table" titlestyle="My Table Header" valuestyle="My Table Body"/> <properties-fragment type="citation" tablestyle="Table Grid 2" > <width type="dxa" value="5000"/> </properties-fragment> <ignore label="extra" /> <ignore label="test" /> </properties-fragments>
<properties-fragments>
element is used to define how PSML properties are formatted into tables. Requires pso-docx version 0.8.21
or higher.
In the above example:
Table Grid
– is set as the default table style (@tablestyle
).PS Table Header
– is the paragraph style for property titles (@titlestyle
).PS Table Body
– is the paragraph style for property values (@valuestyle
)
The @type
attribute is used to override the default style for different PSML fragment types.
The <width>
element under each <properties-fragment>
has a @type
attribute that can be set to either: dxa
(a unit of measure), pct
(percent, requires %
after the value) or auto
.
In Word, 100% is 5000 dxa
(1 dxa
= 1 twentieth-of-a point, 20 dxa
= 1 point).
The <ignore>
element can be used to ignore properties fragments which have that fragment label. It must come after <property-fragment>
and if there is no @label
then all properties fragments will be ignored. Requires pso-docx version 1.1.0
or higher.
<tables>
<tables> <table default="PS Table" headstyle="PS Table Header" bodystyle="PS Table Body" > <width type="pct" value="100%"/> </table> <table role="mytable" tablestyle="Table Grid" headstyle="My Table Header" bodystyle="My Table Body"/> <table role="mytable2" tablestyle="Table Grid 2" layout="fixed"> <width type="dxa" value="5000"/> </table> <col role="mycol1"> <shading fill="00FF00" /> </col> <col role="mycol2"> <borders> <top type="single" color="000000" size="48" /> <bottom type="double" color="FF0000" size="32" /> <start type="dashed" color="00FF00" size="16" /> <end type="wave" color="0000FF" size="2" /> </borders> </col> <row align="start" /> <row role="myrow1" align="center" cantsplit="true"> <shading fill="FF0000" /> <borders> <top type="single" color="000000" size="60" /> </borders> <height type="atleast" value="1000"/> </row> <hcell role="myheader1" valign="top" /> <hcell role="myheader2" valign="bottom"> <shading fill="0000FF" /> <borders> <top type="double" color="000000" size="48" /> </borders> <width type="pct" value="20%"/> </hcell> <hcell role="mycell1" valign="top" /> <hcell role="mycell2" valign="bottom"> <shading fill="1152CC" /> <borders> <bottom type="single" color="123456" size="32" /> </borders> <width type="dbx" value="500"/> </hcell> </tables>
<tables>
element is used to define table styles for each PageSeeder table and can contain any of the following elements multiple times but they must be in this order: <table>
, <col>
, <row>
, <hcell>
and <cell>
.
Using <col>
, <row>
, <hcell>
or <cell>
requires pso-docx version 0.8.21
or higher.
<table>
This element defines table properties and can contain the following attributes and the element <width>
.
@default
: The default word table style, for examplePS Table
(can only be used once and not with@role
or@tablestyle
).@role
: The PSML table role these properties apply to, for examplemytable
.@tablestyle
: The word table style for this role, for exampleTable Grid
.@headstyle
: The paragraph style for header cells, for examplePS Table Header
.@bodystyle
: The paragraph style for other cells, for examplePS Table Body
.@layout
: Allowed values arefixed
if the column widths are fixed orautofit
if they adjust to the content (defaultautofit
). Requires pso-docx version0.8.21
or higher.
The @headstyle
and @bodystyle
can be overridden by wrapping content in a block label.
<col>
This element defines column properties and can contain the following attribute and the elements <shading>
or <borders>
.
@role
: The PSML column role these properties apply to, for examplemycol1
. If there is no@role
then they are the default properties.
<row>
This element defines row properties and can contain the following attributes and the elements <height>
, <shading>
or <borders>
. It overrides the column properties.
@role
: The PSML row role these properties apply to, for examplemyrow1
. If there is no@role
then they are the default properties.@cantsplit
: Iftrue
the row can't be split across a page break (defaultfalse
).@align
: Horizontal alignment with allowed valuescenter
,start
orend
.
<hcell>
This element defines header cell properties and can contain the following attributes and the elements <width>
, <shading>
or <borders>
. It overrides the column and row properties.
@role
: The PSML header cell role these properties apply to, for examplemyheader1
. If there is no@role
then they are the default properties.@valign
: Vertical alignment with allowed valuescenter
,top
orbottom
.
<cell>
This element defines cell properties and can contain the following attributes and the elements <width>
, <shading>
or <borders>
. It overrides the column and row properties.
@role
: The PSML cell role these properties apply to, for examplemycell1
. If there is no@role
then they are the default properties.@valign
: Vertical alignment with allowed valuescenter
,top
orbottom
.
<width>
This element can be used under <table>
, <hcell>
or <cell>
and can have the following attributes:
@type
: Allowed values aredxa
(a unit of measure),pct
(percent, requires%
after the value) orauto
. In Word, 100% is 5000dxa
(1dxa
= 1 twentieth-of-a point, 20dxa
= 1 point).@value
: The width in the unit specified, for example5000
or100%
.
<height>
This element can be used under <row>
and can have the following attributes:
@type
: Allowed values areatleast
(height must be at least this value) orfixed
(height is fixed).@value
: The height, in twentieths of a point (dxa).
<shading>
This element can be used under <col>
, <row>
, <hcell>
or <cell>
and can have the following attribute:
@fill
: The background fill color as 6 hexadecimal digits orauto
, for exampleaabb99
.
<borders>
This element can be used under <col>
, <row>
, <hcell>
or <cell>
and can contain the elements <top>
, <bottom>
. <start>
or <end>
. Each of these elements can have the following attributes:
@type
: Allowed values aresingle
,dashDotStroked
,dashed
,dashSmallGap
,dotDash
,dotDotDash
,dotted
,double
,doubleWave
,inset
,none
,outset
,thick
,thickThinLargeGap
,thickThinMediumGap
,thickThinSmallGap
,thinThickLargeGap
,thinThickMediumGap
,thinThickSmallGap
,thinThickThinLargeGap
,thinThickThinMediumGap
,thinThickThinSmallGap
,threeDEmboss
,threeDEngrave
,triple
orwave
(required).@color
: The border color as 6 hexadecimal digits orauto
, for exampleaabb99
.@size
: The border width in eighths of a point (minimum2
, maximum96
).
<heading>
<heading> <level value="1" numbered="true" wordstyle="heading 1" > <numbered select="true"> <fieldcode regexp="%arabic%" type="SEQ" /> </numbered> </level> <level value="2" wordstyle="heading 2" > <prefix select="true" separator="space"> <fieldcode regexp="\d+\.%arabic%" type="SEQ" /> </prefix> </level> <level value="3" wordstyle="heading 3" > </level> <level value="4" wordstyle="heading 4" > <numbered select="true"> </numbered> </level> <level value="5" wordstyle="heading 5" > <numbered select="true" > <fieldcode regexp="^heading-1^.^heading-2^.^heading-3^.^heading-4^.%arabic%" type="SEQ" /> </numbered> <keep-paragraph-with-next /> </level> <level value="6" wordstyle="heading 6" > <numbered select="true" > <fieldcode regexp= "^heading-1^.^heading-2^.^heading-3^.^heading-4^.^heading-5^.%arabic%" type="SEQ" /> </numbered> <keep-paragraph-with-next /> </level> </heading>
The <heading>
element defines the mapping between the PageSeeder heading level and the Word heading style. By default, every heading level maps to the equivalent heading style (heading level 1 to heading 1 style, heading level 2 to heading 2 style...). Or each PSML heading level can be transformed into an arbitrary DOCX style.
As of pso-docx version 0.7.2
the @numbered
and @prefixed
attributes on <level>
can also be used to map different Word styles to PSML <heading>
with @prefix
or @numbered="true"
.
If the heading is numbered, or has a prefix, it can be transformed into a fieldcode in the output. This is defined by a <fieldcode>
element under the corresponding level/numbered
or level/prefix
.
The level/@prefixed
attribute is ignored in this case.
As of pso-docx version 0.6.2
, the <prefix>
element supports a @separator="[tab|space|none]"
attribute. This defines the character between the prefix and the heading text (tab
is the default) unless @select="false"
in which case neither the prefix, or the separator are output.
The <keep-paragraph-with-next/>
element can be used to keep this on the same line as the next content (also known as Style separator).
The level/@prefixed
attribute is ignored in this case.
Word styles “heading [x]” must be in lower case but all other Word styles must match the case in the DOCX template (for example, “Heading Numbered 1”).
<para>
<para> <indent level="0" wordstyle="Body Text" > <prefix select="true" separator="space" > <fieldcode regexp="Note %arabic%" type="SEQ" /> </prefix> </indent> <indent level="1" wordstyle="List Continue" > <numbered select="true"> <fieldcode regexp= "^heading-1^.^heading-2^.^heading-3^.^heading-4^.^heading-5^.^heading-6^.%arabic%" type="SEQ" /> </numbered> </indent> <indent level="2" wordstyle="List Continue" > </indent> <indent level="3" wordstyle="List Continue" > </indent> <indent level="4" wordstyle="List Continue" > <keep-paragraph-with-next /> </indent> <indent level="5" wordstyle="List Continue" > <numbered select="true" > <fieldcode regexp= "^heading-1^.^heading-2^.^heading-3^.^heading-4^.^heading-5^.^heading-6^.^para-^.%arabic%" type="SEQ" /> </numbered> </indent> <indent level="6" wordstyle="List Continue" > <numbered select="true" > <fieldcode regexp= "^heading-1^.^heading-2^.^heading-3^.^heading-4^.^heading-5^.^heading-6^.^para-1^.^para-5^.%arabic%" type="SEQ" /> </numbered> <keep-paragraph-with-next /> </indent> <!-- Prefixed paragraphs --> <indent level="1" prefixed="true" wordstyle="List Manual" /> <indent level="2" prefixed="true" wordstyle="List Manual 2" /> <indent level="3" prefixed="true" wordstyle="List Manual 3" /> <!-- Numbered paragraphs --> <indent level="1" numbered="true" wordstyle="List Number" /> <indent level="2" numbered="true" wordstyle="List Number 2" /> <indent level="3" numbered="true" wordstyle="List Number 3" /> </para>
Element <para>
and the @wordstyle
attribute map the PageSeeder paragraph indent level to a Word style. It can contain an <indent>
element which can contain the following elements but they must be in this order: <prefix>
, <numbered>
and <keep-paragraph-with-next>
.
As of pso-docx version 0.6.1
, the @numbered
and @prefixed
on <indent>
can be used to apply different Word styles to PSML <para>
with @prefix
or @numbered="true"
.
If the paragraph is numbered, or has a prefix, it can be transformed into a fieldcode in the output. This is defined by the <fieldcode>
element under the corresponding indent/numbered
or indent/prefix
.
The indent/@prefixed
attribute is ignored in this case.
As of pso-docx version 0.6.2
the <prefix>
element can have a @separator="[tab|space|none]"
to define the character between the prefix and the paragraph text (tab is the default) but if it has @select="false"
the prefix and separator won’t be output.
The <keep-paragraph-with-next/>
element can be used to keep this on the same line as the next content (also known as Style separator).
The indent/@prefixed
attribute is ignored in this case.
<title>
<title wordstyle="heading 1"/>
Element <title>
is used to define the Paragraph Style of each section title.
By default title is set to heading 1
. It can be transformed into any value that exists in the Word Export Template.
<nlist>
Contains the list definitions for numbered lists inside of Word.
<nlist liststyle="Numbered List" /> <role value="highlight" liststyle="Highlighted Numbered List" /> </nlist>
As of pso-docx version 0.6.1
, the @liststyle
on <nlist>
and <role>
can be used to apply a specific Word list style. The <default>
and <level>
elements are no longer supported under these elements.
If the PSML list has a @role
attribute, it can be associated with a Word list style using the <role>
element.
<list>
Contains the list definitions for unnumbered lists inside of Word.
<list liststyle="Bulleted List" > <role value="highlight" liststyle="Highlighted Bulleted List" /> </list>
As of pso-docx version 0.6.1
, the @liststyle
on <list>
and <role>
can be used to apply a specific Word list style. The <default>
and <level>
elements are no longer supported under these elements.
If the PSML list has a @role
attribute, it can be associated with a Word list style using the <role>
element.
The @type
on <list>
and <nlist>
in PSML is ignored as it could clash with the default and role based word styles. To alert editors to this in PageSeeder the following custom CSS could be added:
.psml-content
ul[data-type]:before,
ol[data-type]:before
{
color: white;
content:"LIST TYPE IS NOT SUPPORTED BY WORD EXPORT";
background: red;
border-radius: 2px;
padding: 1px 4px;
}
.psml-content ul[data-type]
li, ol[data-type] li
{
color: red
}
<listpara>
Contains style for a <para>
inside a <list>
or <nlist>
that is not the first <para>
. The @value
corresponds to the nesting level of the <list>
or <nlist>
. Requires pso-docx version 0.7.5
or higher.
<listpara> <level value="1" wordstyle="List Continue" /> <level value="2" wordstyle="List Continue 2" /> <level value="3" wordstyle="List Continue 3" /> <level value="4" wordstyle="List Continue 4" /> <level value="5" wordstyle="List Continue 5" /> <level value="6" wordstyle="List Continue 6" /> </listpara>
<preformat>
Contains style for <preformat>
elements.
<preformat wordstyle="HTML Preformatted"/>
<xref>
Contains styles for specific types of cross-references (the child elements are optional but must appear in the order below). Requires pso-docx version 0.7.4
or higher.
<xref> <citation referencestyle="My Citation Reference" /> <endnote textstyle="My Endnote Text" referencestyle="My Endnote Reference" /> <footnote textstyle="My Footnote Text" referencestyle="My Footnote Reference" /> <xrefconfig name="field" hyperlinkstyle="My Field Link" referencestyle="My Field Reference" /> <xrefconfig name="term" hyperlinkstyle="My Term Link" /> </xref>
For <citation>
the text style is always Bibliography
and the default @referencestyle
is the default character style (see <default>
above).
For <endnote>
the default @textstyle
is Endnote Text
and the default @referencestyle
is Endnote Reference
.
For <footnote>
the default @textstyle
is Footnote Text
and the default @referencestyle
is Footnote Reference
.
There might be multiple <config>
elements and the @name
refers to the @config
on the XRef. The default @hyperlinkstyle
and @referencestyle
are defined in the <default>
element above. Requires pso-docx version 0.7.6
or higher.
In the word-export-template.docx
, any hyperlink or reference styles must be character only styles.