Skip to main content

 Publishing

Publishing PageSeeder data to print, the Web or both

Microsoft Word docx – export config

Below is an explanation of options for configuring PageSeeder to create a .docx format file from PSML source documents. It is companion technology to the Microsoft Word docx – import config.

A copy of the default Word export config is available for reference, see the default config example.

Additional information regarding docx support in PageSeeder is:

Overview

The Microsoft Word Export Config (word-export-config.xml), together with the Word Export Template (word-export-template.dotx), support the conversion of PSML data to the docx file format. There is wide support for docx in applications such as Microsoft Word, Google Docs, and publishing tools like Adobe InDesign.

Using docx as a target format for PageSeeder publications means that the styles in existing Word documents can provide the page layout settings for PSML labels and structures. Mapping that information from PageSeeder into Word is the purpose of the word-export-config, and this document.

Administrator rights are necessary to access many of the Export Config features.

Usage

There are two ways to customize the default config, both require that a user is either an administrator on the server, or a manager on the project.

Providing the member meets one of these, they can use this method to modify the config for their own use ONLY:

  1. Sign in to PageSeeder, and select a project or group.
  2. Select Developer under Account menu > Preferences, Layout preference.
  3. To change the config for yourself 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,
    1. The Member publish configurations page only has one row and applies to all document types.

Alternatively, the member can change the configuration for all group members:

  1. Click Project administration menu > Template > Template configuration, note the options under the Publication types table in the Word export column,
  2. To change the configuration for all documents, select override under the default option in the default row.
    1. To revert to the default config, select delete under the edit option in the default row.
  3. To change the configuration for a specific publication type, click create under Word export column in the row for that type. 

To autocomplete the config file contents, press ctrl-space when editing.

Word export template file

By design, there is no formatting information in PageSeeder content. This is not because formatting isn’t important, rather, it is to support the concept of separating content and format. The architectural objective for this is that the exclusion of formatting leads to:

  • better reuse of content
  • better productivity for writers
  • more flexibility of delivery formats.

Moving formatting further along the document lifecycle, and adding it programmatically instead of manually, improves quality and consistency. 

Using Word to get the most out of PageSeeder requires first creating a Word document with the appropriate styles, margins, page size and so on. Next, this file must be available to the export process, so upload it to the project. Finally, map the PSML content and labels to the Word styles, using the following relationships:

  • 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>.
  • Images – can have a character style.
  • Metadata – map pre-defined properties.
  • Fields – including footnotes, endnotes, index entries.
  • References – including Xrefs and links.

The location of the default docx template for a project is:

WEB-INF/config/template/[project-name]/publication/default/
    word-export-template.docx

Word export template file - Numbering

An alternate approach to mapping the PSML to your document, is to reformat the existing Word template, where the mapping already exists. For this, 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).

Word numbering is famously hard to tame, but it can be made to work. In order to get the right results from the PageSeeder export, the word-export-config and the word-export-template must have the proper configuration of bullet and numbered list styles.

Users unfamiliar with Word multilevel lists, or list styles will find it easier to modify, or refer to, the already-configured word-export-template. The ways to create a new list style are:

  1. Create a paragraph style for each level in the list, for example MyList1MyList2.
    1. Select Define New List Style from the Multilevel List menu (not Define New Multilevel List).
    2. 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.
    3. Click More and link the correct paragraph style to each level.
  2. Alternatively, map PSML structures into the Word styles List NumberList Number 2 etc.

Define New List Style

Define New List Style – Define numbering options

Define New List Style - Link level to paragraph style

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.

In Word, styles can have multiple names, separated by commas. For 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 refer to styles in use in the template.
  • The heading styles built-in to Word are special – refer to them using lower case, for example wordstyle="heading 1".
  • Sometimes Word style names display as upper case but are actually lower case, if a style does not apply, try changing the reference to lower case.

<core>

This element populates the Word file properties 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>

To use these values, select ‘Config’ in the Choose Word core attributes field of the Document publish panel. Or, set the manual-core parameter to Config. The export mapping uses the Word property fields above and the token values below.

TokenPageSeeder 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".

Document export panel – Create docx options

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 named Version. This can be added in Word under Info > Properties > Advanced Properties > Custom. Requires pso-docx version 0.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">
  <!-- 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>

PSML element <toc> is a placeholder for the DOCX Table of Contents (ToC) field, which prompts Word to generate a ToC using any of the following types of objects, strictly in this order:

  • <outline> – generate the ToC from any native Word styles with an outline level. For example, use the built-in Word heading styles by setting the @generate attribute of <outline> to true. The value of the @select attribute can be an integer from 1 to 9.
<outline generate="true" select="3-6" />
  • <paragraph> – use specific paragraph styles by setting the @generate attribute of <paragraph> to true. 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 to false.

As of pso-docx version 0.8.28 or higher:

  • The <toc> element under <config> relates to the generation of a root (top-level) Table of Contents.
  • The <toc> element can also appear under <elements>, where it generates a non-root (branch-level) Table of Contents, for example, at the Chapter level.

The use of the <headings> element under <toc> is deprecated – use <outline> instead.

<default>

This element sets the default conversion options.

<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>

All the following elements are optional:

  • <defaultparagraphstyle> – any <block>without a specific mapping to a DOCX style transforms to a default style name. Usually the is Body Text, but it can be any paragraph style name in word-export-template. Where the template doesn’t have a style that matches, the default style is set to Normal. This element has no effect if block/@default described below is set.
<defaultparagraphstyle style="Body Text"/>
  • <defaultcharacterstyle> – defines a character style for all inline elements with no specific mapping. The default value is Default Paragraph Font<defaultcharacterstyle>can be any character style name in the word-export-template. Where the template doesn’t have a style that matches the value is reset. This element has no effect if inline/@default described below is set.
<defaultcharacterstyle style="Default Paragraph Font"/>
  • <comments> – this adds a comment to each fragment via an email link to PageSeeder from any standard email application. This allows for document review offline. By default, this value is set to false.
<comments generate="false"/>
  • <mathml> – converts any Math ML object back to Open Office math ml objects for Word. By default, this value is set to false.
<mathml generate="false"/>
  • <citations> – xrefs to properties fragments in a document with type @documenttype become DOCX citations, and a DOCX bibliography is inserted after the <section id="title"> content. An inline label attribute value of "pageslabel" directly after the xref, its content becomes the citation page or page range: 
<xref documenttype="bibliography" ... >
             ...</xref>
<inline label="pages">10 - 20</inline>

Requires additional post-processing and pso-docx version 0.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 using ps:process ANT task where xrefs/@types includes alternate. Requires pso-docx version 0.8.1 or higher.
<endnotes documenttype="endnotes"/>
  • <footnotes> – xrefs to fragments under <section id="content"> in a document with type @documenttype become DOCX footnotes. The xrefs must have @type="alternate" and the document must be generated using ps:process ANT task where xrefs/@types includes alternate. Requires pso-docx version 0.8.1 or higher.
<footnotes documenttype="footnotes"/>
  • <xrefs> – if type="cross-reference" then PSML xrefs become DOCX REF, instead of HYPERLINK. Unlike the HYPERLINK option, REF has an ‘Update field’ option that prompts Word to refresh pointers to numbered paragraphs or headings.

    As of version 0.7.0, xrefs with @display="template" and @title containing {parentnumber} or {prefix} become DOCX REF even without setting @type above. Also <xrefs> supports the following attributes:
    • @hyperlinkstyle The Word style for xrefs pointing outside the document (default PS Hyperlink).
    • @referencestyle – The Word style for xrefs pointing within the document (default PS Reference).
<xrefs type="cross-reference"
       hyperlinkstyle="My Hyperlink"
       referencestyle="My Reference" />

Further configuration information for xrefs in DOCX, see <xref>.

  • <placeholders> – maps styles for PSML <placeholder> elements with the following attributes: Requires pso-docx version 0.8.8 or higher.
    • @resolvedstyle – The Word style for resolved placeholders (default DefaultParagraphFont).
    • @unresolvedstyle – The Word style for unresolved placeholders - no corresponding metadata property (default DefaultParagraphFont).
<placeholders resolvedstyle="My Placeholder"
              unresolvedstyle="My Unresolved" />
  • <indexdoc> – inserts a DOCX index after the <section id="title"> content. See <inline> for how to insert index entries with the following attributes: Requires pso-docx version 0.8.20 or higher.
    • @documentlabel – The label that identifies the index document.
    • @columns – The number of columns in the index - from 1 to 4 (default 2).
<indexdoc documentlabel="myindex" columns="1" />

In the word-export-template.docx, only character styles can 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>

Transforms can apply specifically to documents with a certain label. Define this by setting the @label attribute inside a separate <elements> element.

<elements label="warranty">

If set, options under this element only apply to documents with this label. In the example above, the options under <elements> apply only to a document with label ‘warranty’.

Where <elements> have a @blocklabel, the options underneath 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">
  • <elements> with @blocklabel or @fragmentlabel only support  <heading>, <para>, <list> and <nlist> options.
  • there is no support for both @blocklabel and @fragmentlabel on the same <elements>.
  • elements/@blocklabel options override elements/@fragmentlabel options.
<document>
<config>
  <elements>
    <document wordsection="3" />
  </elements>
  <elements label="appendix">
    <document wordsection="1" />
  </elements>
  <elements label="landscape">
    <document wordsection="2" />
  </elements>
</config>

Useful for when a group of styles need to be treated differently, element <document> defines the section in the word-export-template that each PSML document will use. It requires a @wordsection attribute that matches 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.

If the word-export-config does not define a section number, 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> handles all <block> elements, with the @default attribute defining how to handle all <block> elements that have no mapping to a paragraph style. It accepts two values:

  • generate-ps-style – this naming convention generates a Word style for each label:
ps_blk_[name-of-label]
  • default – maps a default Word style name.

Under <block>, two elements are valid and must be in this order:

  • <label> – transforms the content of this block into the Word style of the attribute @wordstyle. The attribute @wordstyle under <label> can also contain generate-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, known in Word as a 'Style separator'.
  • <ignore> – means the content inside this block won’t be transformed on export.

Using <ignore> or <label> even under <elements> with @label, disables  generate-ps-style for that block label on all documents.

<image>

Defines a Word style for <image> elements. In PageSeeder, an image is an inline object, so the value of the @wordstyle attribute must map to a character style, not a paragraph style. Requires pso-docx version 0.8.19 or higher.

The <image> can have a @maxwidth attribute with the value in pixels, useful for scaling down larger images (default 620).

@widelabel defines an image label that ignores @maxwidth to accommodate large images such as a landscape drawing. 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 handles all <inline> elements. The @default attribute defines the character style that maps to any inline elements with no other handling. The options are: generate-ps-style and any other value.

  • generate-ps-style – this naming convention generates a Word style for a label:
ps_inl_[name-of-label]
  • default – maps a default Word style name.

Five elements are valid under <inline>, but they must be in the following order: 

Using <ignore>, <tab> or <label> even under <elements> with @label will disable  generate-ps-style for that inline label on all documents.

<label> – defining a label name under <ignore> will skip the transformation.

Defining the label name using the attribute @value under <label> will transform the contents into the style that maps to the value of the attribute @wordstyle. The attribute @wordstyle can also contain generate-ps-style to force the generation of a style for each inline label.

<ignore> – ignores labels on transformation.

<tab> – defines a style through the value of the attribute @label under <tab>.

<fieldcode> – where the inline label matches the value of the @label attribute under <fieldcode>, the contents transform into a Word fieldcode on output. The name in the @value attribute determines the generation of the fieldcode.

<index> – where the inline label value matches the value of the @label attribute under <index>, the contents transform into a Word index entry, with a colon character in the content ":" indicating an index sub-entry. For example, the following inline objects in PSML would create two index entries. A first-level entry of “speed” and a second-level entry under speed of "fast".

Lorem ipsum<inline label="ind">speed</inline> and lorem extra<inline label="ind">speed:fast</inline>.

To prevent the index entry breaking to the next page, the inline index label ("ind" in the example above) should be directly after the target term in the content, with no space in between. Requires pso-docx version 0.8.20 or higher.

<preformat>

Contains style for <preformat> elements.

<preformat wordstyle="HTML Preformatted"/>
<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> specifies how to format PSML properties as tables. Requires pso-docx version 0.8.21 or higher.

In the above example:

  • @tablestyle – sets the default Word table style as Table Grid.
  • (@titlestyle) – sets the paragraph style for property titles as PS Table Header.
  • (@valuestyle) – sets the paragraph style for property values as PS Table Body.
  • @type attribute – overrides the default style for different PSML fragment types.
  • <width> element – under each <properties-fragment> has a @type attribute to express the size in 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).

  • <ignore> element – use to ignore properties fragments with that fragment label. Put it after <property-fragment>. To ignore all properties fragments, don't specify a @label attribute. 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 defines Word table styles for each PageSeeder table. It can contain multiple entries of the following elements, but they must be in this order: <table>, <col>, <row>, <hcell> and <cell>.

Processing <col>, <row>, <hcell> or <cell> requires pso-docx version 0.8.21 or higher.

<table>

Defines table properties through the following attributes and the element <width>.

  • @default – the default Word table style, for example "PS Table" (this value can only be used once and not with @role or @tablestyle ).
  • @role – the PSML table role these properties apply to, for example mytable.
  • @tablestyle – the Word table style for this role, for example Table Grid.
  • @headstyle – the paragraph style for header cells, for example PS Table Header.
  • @bodystyle – the paragraph style for other cells, for example PS Table Body.
  • @layout – allowed values are fixed if the column widths are fixed or autofit if they adjust to the content (default autofit). Requires pso-docx version 0.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 example, mycol1. 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 example myrow1. If there is no @role then they are the default properties.
  • @cantsplit – If true the row can't be split across a page break (default false).
  • @align – Horizontal alignment with allowed values center, start or end.
<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 example myheader1. If there is no @role then they are the default properties.
  • @valign – Vertical alignment with allowed values center, top or bottom.
<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 example mycell1. If there is no @role then they are the default properties.
  • @valign – Vertical alignment with allowed values center, top or bottom.
<width>

This element can be used under <table>, <hcell> or <cell> and can have the following attributes:

  • @type – Allowed values are 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).
  • @value – The width in the unit specified, for example 5000 or 100%.
<height>

This element can be used under <row> and can have the following attributes:

  • @type – Allowed values are atleast (height must be at least this value) or fixed (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 or auto, for example aabb99.
<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 are single, dashDotStroked, dashed, dashSmallGap, dotDash, dotDotDash, dotted, double, doubleWave, inset, none, outset, thick, thickThinLargeGap, thickThinMediumGap, thickThinSmallGap, thinThickLargeGap, thinThickMediumGap, thinThickSmallGap, thinThickThinLargeGap, thinThickThinMediumGap, thinThickThinSmallGap, threeDEmboss, threeDEngrave, triple or wave (required).
  • @color – The border color as 6 hexadecimal digits or auto, for example aabb99.
  • @size – The border width in eighths of a point (minimum 2, maximum 96).
<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" numbered="true" prefixed="true" wordstyle="heading 4">
    <prefix select="false" />
  </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...). Alternatively, 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" as follows:

  • @prefixed="true" @numbered="true" – matches a processed numbered heading (with the prefix generated by PageSeeder). In this case, include <prefix select="false" /> so the prefix is not output to Word causing double numbering.
  • @prefixed="true" by itself – matches when the prefix was manually added.
  • @numbered="true" by itself – only matches when the prefix number can’t be resolved.

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, known in Word as a '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" />

  <!-- Numbered paragraphs -->
  <indent level="1" numbered="true" wordstyle="List Number" />

  <indent level="2" numbered="true" wordstyle="List Number 2" />


  <!-- Numbered prefixed paragraphs -->
  <indent level="1" numbered="true" prefixed="true" wordstyle="Para Indent">
    <prefix select="false" />
  </indent>
  <indent level="2" numbered="true" prefixed="true" wordstyle="Para Indent 2">
    <prefix select="false" />
  </indent>

</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" as follows:

  • @prefixed="true" @numbered="true" – matches a processed numbered paragraph (with the prefix generated by PageSeeder). In this case include <prefix select="false" /> so the prefix is not output to Word causing double numbering.
  • @prefixed="true" – by itself matches when the prefix was manually added.
  • @numbered="true" – by itself only matches when the prefix number can’t be resolved.

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, known in Word as a '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.

When a PSML list has a @role attribute, the <role> element in the export-config uses the “content” of the @value attribute to map that role to a DOCX list style as expressed by the “content” of the @liststyle attribute.

List Style – Numbered List – current list

<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.

List – Bulleted List

The PSML <list> or <nlist> as a whole is mapped to a Word list style. PSML list <item> elements can not be individually mapped to different paragraph styles.

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>

Defines the styles for paragraphs in between items in a <list> or <nlist>. The @value on the <level> element represents how many levels of nesting the items are above the paragraph. 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>

Example DOCX

Example <listpara> in DOCX

Example PSML

<fragment id="1">
   <nlist start="1">
      <item>List level 1</item>
   </nlist>
   <para indent="1">List continue: Lorem ipsum dolor sit amet.</para>
   <nlist type="loweralpha" start="1">
      <item>List Level 2</item>
   </nlist>
   <para indent="2">List continue 2: Lorem ipsum dolor sit amet.</para>
   <nlist type="lowerroman" start="1">
      <item>List Level 3</item>
   </nlist>
   <para indent="3">List continue 3: Lorem ipsum dolor sit amet.</para>
   <nlist type="upperroman" start="1">
      <item>List Level 4</item>
   </nlist>
   <para indent="4">List continue 4: Lorem ipsum dolor sit amet.</para>
   <nlist type="upperalpha" start="1">
      <item>List level 5</item>
   </nlist>
   <para indent="5">List continue 5: Lorem ipsum dolor sit amet.</para>
   <nlist type="loweralpha" start="1">
      <item>List Level 6</item>
   </nlist>
<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>
  <footnote textstyle="My Footnote Text"
            referencestyle="My Footnote Reference" />

  <endnote textstyle="My Endnote Text"
           referencestyle="My Endnote Reference" />

  <citation referencestyle="My Citation Reference" />

  <xrefconfig name="field"
              hyperlinkstyle="My Field Link"
              referencestyle="My Field Reference" />

  <xrefconfig name="term"
              hyperlinkstyle="My Term Link" />
</xref>
  • <footnote> element – defines the footnote text and refererence styles (the default @textstyle is Footnote Text and the default @referencestyle is Footnote Reference.
  • <endnote> element – defines the endnote text and refererence styles (the default @textstyle is Endnote Text, and the default  @referencestyle is Endnote Reference.
  • <citation> element – defines the citation reference style, and the default @referencestyle is the default character style (see <default> above). The bibliography text style is always Bibliography.
  • multiple <xrefconfig> elements and the @name refers to the @config on the XRef. The define the xref hyperlink and reference styles (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.

Created on , last edited on