How to export footnotes/endnotes to DOCX
Skills required | XML |
---|---|
Time required (minutes) | 15 |
Intended audience | Developer |
Difficulty | Easy |
Category | Document |
Objective
This tutorial demonstrates how to create footnotes or endnotes and export them to Word DOCX.
Prerequisites
To complete this tutorial requires:
- PageSeeder administrator access to a server with PageSeeder version 6.2 or later installed.
All the files for this tutorial are on Github .
Tutorial
Project setup and installing configuration bundle
- Login to PageSeeder as an administrator.
- Go to the project where you would like to install these capabilities. Alternatively create a new project by clicking the
System administration button at top right. Then click on New project under Projects & Groups and enter a project name, plus any description, then Submit. - Click the
Project administration button at the top. - Select Template files from the left menu and click the
Create button at the bottom of the page to open the Samples dialog. - Install a configuration bundle – Click the
Bundle button, then in the Bundle type field, select Document type from the dropdown. - Click the Select button to the right of a bundle – for this example, select Basic auto-numbered publication. You can also select Intermediate or Advanced if you want bibliography or glossary features.
- Install the bundle under the root document type for your publication (e.g
references
, shown in the Document type field on the right of the dialog). Click Install.
Verify package content - project configuration files
In the Template files page check the files as follows.
Export process
The psml/references/export
folder (or the document type you specified) contains the following files:
Filename | Description |
---|---|
build.xml | Custom ANT script for exporting to docx. Not required but is used for this tutorial. |
psml-to-docx.xsl | XSLT that adds the document labels necessary to format the publication root document. Not required but is used for this tutorial. |
Document types
Select Template configuration from the left menu which should display these PSML document types:
Document type | Description |
---|---|
default | The content of a publication. Includes a CSS style to display footnote and endnote references as superscripts in the user interface. |
references (or your type) | The root document of a publication. Includes the custom export configuration. |
endnotes | Endnotes for a publication. |
footnotes | Footnotes for a publication. |
help | Not required for this tutorial. |
XRef configuration
Select Edit XRef configs (top right).
Filename | Description |
---|---|
xref-config.xml | The Xref configuration for the import of cross-references including footnotes, endnotes, citations, and more as listed below. |
The following xref configs should be listed (see Xref config):
- footnote – to insert a footnote reference.
- endnote – to insert an endnote reference.
- para – Not required for this tutorial.
- internal-para – Not required for this tutorial.
- numbered-heading – Not required for this tutorial.
- caption – Not required for this tutorial.
Creating a publication
Create a publication root document and content as follows:
- In PageSeeder go to a group under the project from Step 1. Alternatively create a new group by clicking the
Project administration button at the top. Then select Create group from the left menu and enter a group name, plus any description, then Submit and Go to group. - In this group create or open an existing document of the root type you selected previously (e.g.
references
). - Click the Document information icon on the right, click Make this document a publication, ensure there is a Publication ID and for this example, select Publication type "
default
". Click Submit then Save. - If there is no existing content, double-click in the root document, click Browse and create a document (for example
default
type), select it and save. On the root document press Ctrl-S to save everything. - Click a content document, add some headings and paragraphs if required.
Footnotes or Endnotes
The model for this implementation is that a custom link type generates a simple link title and prompts the user to create a new fragment, or refer to an existing one, in the footnote or endnote document.
The generation of the link title, an “f” or an “e” with a numeric qualifier, happens when saving the xref. Upon export of the publication to Word, there is a transformation of these objects to native docx footnotes or endnotes.
This solution requires the creation of custom document types to hold the footnote or endnote fragments. Whether this document already exists will depend on whether the content came from an impoerted docx file that already had footnotes or endnotes, or whether the document is being written in PageSeeder.
To determine this, follow these steps
- Go to the folder containing your content documents.
- Create a document with document type Footnotes. If you get an error then it already exists, otherwise click the
icon at top right enter edit mode. - Add one or more fragments containing footnote content.
- Create a document with document type Endnotes. If you get an error then it already exists, otherwise click the
icon at top right enter edit mode. - Add one or more fragments containing endnote content.
- In a content document, enter edit mode by double-clicking on a paragraph.
- Place the cursor in the text and select the
Insert/edit cross-reference icon, available either in the document toolbar at the top or in the editing context menu when you right-click in the text. The Xref dialog opens. - In the Configuration field, select the XRef configuration, either Footnote or Endnote, from the drop-down. The Footnotes or Endnotes document displays in the main section. The process for inserting both footnotes and endnotes is similar. The following images display the footnote process:
- In the main section, click on the footnote fragment that you want to reference.
- The xref details display. The "Title template" field contains the link title that displays in your document. It has the generated letter “f” and the
{fragment}
, which is automatically populated with a numeric qualifier – the fragment number in the footnotes document – when you save the xref details. The "Link type" field showsalternate
(as specified in the footnote xref template). - Click Save to insert the xref in your document. In the following image, the link text "f4" references fragment 4 in the Footnotes document. Press Ctrl-S to finalize the insertion.
Export as a Word document
- Go to any document in your publication.
- Click the Document export (rocket) icon in the left margin.
- Under the Choose an export action drop down, select Export publication as custom DOCX and click Run.
- Open the document in Microsoft Word and see how the footnotes and endnotes are displayed by Word.