It's better when it's simple

User Tools

Site Tools

plugin:odt Export

Compatible with DokuWiki

  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes
  • 2014-05-05 "Ponder Stibbons" yes
  • 2013-12-08 "Binky" yes

plugin Exports a page to the Open Document format used by and other word processors

Last updated on
Syntax, Render
Conflicts with
inlineeditor, quickedit

Tagged with export, odt, pdf

This plugin allows you to export a page to the OpenDocument format used by, and other word processors. This is especially useful when you need to print or to give a single page to a customer (Hint: can also export to PDF).

This plugin was initialized by Andreas Gohr, and was then further developed and maintained by Aurelien Bompard.

The older version of ODT-plugin with default template support is from Florian Lamml.

Actually ODT is maintained by LarsDW223.


PHP 5.5 (for PHP 5.3.3+ and PHP 5.4.X, see this workaround)

There are no requirements in general but some features have requirements:

  • Bookcreator: for bookcreator support you need to install the bookcreator plugin too.
  • Pagebreak: to be able to insert pagebreaks manually you need to install the pagebreak plugin too.


To make a single page exportable you can add the following macro to the page:


A better way is to integrate an export button into your template.

If you use the default template just switch the button on in the configuration menue.

Otherwise use the following to add another button in the upper or bottom button row of the template1)

<form class="button" method="get" action="<?php wl($ID)?>">
  <div class="no">
    <input type="submit" value="Export to ODT" class="button" />
    <input type="hidden" name="do" value="export_odt" />
    <input type="hidden" name="id" value="<?php echo $ID?>" />

Or use this for a simple 16×16 icon somewhere in your template:

  <a href="<?php echo exportlink($ID, 'odt')?>"><img src="<?php echo DOKU_BASE?>lib/images/fileicons/odt.png" alt="ODT Export" /></a>

You can mix the 2 previous methods, and get a button with an image inside, with this code:

<form class="button" method="get" action="<?php wl($ID)?>">
  <div class="no">
    <button type="submit" class="button">
      <img src="<?php echo DOKU_BASE?>lib/images/fileicons/odt.png" alt="ODT Export" />
      Export to ODT
    <input type="hidden" name="do" value="export_odt" />
    <input type="hidden" name="rev" value="<?php global $REV; echo $REV?>" />
    <input type="hidden" name="id" value="<?php echo $ID?>" />


Most settings or configuration options in the ODT plugin can be set in the ODT plugin configuration, by passing the setting as a URL request parameter or by using the syntax tag.

The precedence is like this (first entry has highest precedence, last entry has lowest):

  1. syntax tag
  2. URL request parameter
  3. ODT plugin configuration setting
  4. DokuWiki configuration setting
    (only relevant for 'toc_maxlevel', see Configuration section below)

This is an example for passing the setting orientation as a URL request parameter:

The same works for syntax tags. The syntax tags for settings always have the same format:


Here again the example for the setting orientation:



The current release has the following configuration options:

Config option name Function
tpl_dir Sub-directory for the templates in the media manager. Upload your ODT template files to this directory.
odt_template ODT file which shall be used as a template. Per default this field is empty. In that case default styles are used.
showexportbutton Display the ODT Export Button?
media_sel Which @media selector shall be used to query CSS properties? For example 'print' or 'screen'. Currently this only affects the ODT export of plugins, e.g. the Wrap plugin.
css_template The dokuwiki template to use for CSS import. This only affects the CSS content given to plugins. It does not affect the look of the DokuWiki basic syntax.
usestyles You can give a comma separated list of plugins of which the style.css or screen.css should be used for ODT generation. By default only print.css and odt.css are used.
twips_per_pixel_x Twips per pixel on the X axis.
twips_per_pixel_y Twips per pixel on the Y axis.
format The page format of the exported document. The current formats are currently supported:
A6, A5, A4, A3, B6 (ISO), B5 (ISO), B4 (ISO), Letter, Legal, Long Bond, Tabloid, B6 (JIS), B5 (JIS), B4 (JIS), 16 Kai, 32 Kai, Big 32 Kai, DL Envelope, C6 Envelope, C6/5 Envelope, C5 Envelope, C4 Envelope, #6 3/4 Envelope, #7 3/4 (Monarch) Envelope, #9 Envelope, #10 Envelope, #11 Envelope, #12 Envelope, Japanese Postcard.
orientation Orientation of the exported document. This allows the option 'portrait' or 'landscape'.
margin Top, Right, Bottom, Left Margins for the exported document in centimeters.
disable_links If set to 'Yes', links will not be encoded as links but just as plain text.
toc_maxlevel Maximum depth for the table of contents. If empty, the value of the global DokuWiki option 'maxtoclevel' is used.
toc_leader_sign The leader sign to be inserted in the table of contents.
toc_indents The indentation for the table of contents per level. The values are absolute values in centimeters, not relative to the previous level. E.g. the setting '0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5' leads to a indentation of 0.5 centimeters more per level. While '0, 1, 1, 1, 1, 1, 1, 1, 1, 1' keeps level 1 not indented and all other levels have the same 1 centimeter indentation.
toc_pagebreak Insert a pagebreak after the table of contents?
toc_style Style to be used for the table of contents in CSS format, e.g.: 'color:red;'. Each level uses the same style per default. You can assign specific styles using the syntax tag.

Additional syntax tags

There are some syntax tags for additional features which can not be set in the configuration alone because e.g. the position matters or to provide more flexibility. These tags are described in this section.


A manual pagebreak can be inserted by adding the syntax tag <pagebreak> in the wiki page. This feature requires the plugin pagebreak.


The syntax tag page can be used to set the page format, orientation and margins with one single command. The format is the following:


The following example sets the page format A3, orientation landscape and all margins to 1 centimeter.


You can also omit parameters that you do not want to change, e.g.:


That changes the page format and orientation but not the margins.

If you want to alter a single page property only, then you can use the settings tags for format, orientation or the margins alone. See some examples below:




A change of the page format will finish the current page, cause a pagebreak and the next page will then use the newly set page format.


The toc syntax tag can be used to insert a table of contents at the position of the tag. Without inserting the toc syntax tag, no table of contents will be created at all. The minimum syntax is:


This will create a table of contents with all relevant settings taken from the ODT plugin configuration. The title will be 'Table of Contents' (depending on the language set).

The following options for the toc syntax tag do exist:

  • maxlevel: this overwrites toc_maxlevel
  • title: this overwrites the language specific default title 'Table Of Contents'
  • leader_sign: this overwrites toc_leader_sign
  • indents: this overwrites toc_indents
  • pagebreak: this overwrites toc_pagebreak
  • styleL1 … styleLN: N = maxlevel, overwrites toc_style

These have all the same meaning as the corresponding configuration settings. Only exception is styleL1 … styleLN. The configuration setting toc_style sets the style for the whole table of contents. styleL1 only sets the style for toc level 1, styleL2 only sets the style for toc level 2…

All these options are optional. If you omit one, then the corresponding setting of the configuration (or URL request parameter) will be used. Every option needs to be finished with a ; .

Here are some examples (all one line):


These tags enable or disable link creation just like the configuration setting. Here is the syntax:




To get some information about the current development release/master branch, have a look at the development preview page.


There are three ways of customizing how the output will look like :

  1. Modify an export of the wiki:syntax page:
    • Export the wiki:syntax page
    • Open the result with a ZIP-Archive tool and replace the provided styles.xml with the one from your document.
      Be careful, DokuWiki's caching system may get in the way when you do that. Remember to clean up your cache.
  2. Use the OpenOffice feature to load the styles from an existing file or template :
    • export your page in ODT, and open it in OpenOffice,
    • bring up the styles panel (F11),
    • click on the top-right icon,
    • choose “Load styles…” in the menu,
    • select all the checkboxes on the bottom (including “overwrite”),
    • click “From file…” on the bottom right and select your customized file, or select an existing template in the list.
  3. Use a pre-made template, see the following section for details on this feature.

Templates support

You may use templates to export your document. A template is a regular ODT file, as produced by OpenOffice (for example, not tested with other ODT-supporting applications).

In your wiki page, add the following code:

  {{odt>template:your template file name.odt}}

and upload your template to the wiki using the media manager. By default, you must put it in an :odt namespace (Meaning an “odt” directory right below the root in your wiki). The folder name can be configured using the admin page.

The exported page will be added after the content of your template. If you include the string DOKUWIKI-ODT-INSERT in the template, the wiki page will be inserted there (replacing the string).

:!: Warning : the DOKUWIKI-ODT-INSERT string must not be formatted in any way. To do that, select the line with this string, go to the “Format” menu, and click on the “Default Format” option (the first one).

There are two additional tags you may use in your template : DOKUWIKI-ODT-CUT-START and DOKUWIKI-ODT-CUT-STOP. All the text between these tags will be removed on export. There's a good reason for this feature : in an ODT file, the only styles that will be saved are the styles which are applied to some content in the document. If you want to create an empty ODT document for this plugin, and still want to define styles which will be applied to the wiki content, you have to write some dummy text, apply the styles to this text, and surround the text in the DOKUWIKI-ODT-CUT-START and DOKUWIKI-ODT-CUT-STOP tags. This way, the styles will be retained in the ODT file, but the dummy text will be removed on export.

ODT support for plugins

If you use other syntax plugins, their output may not appear in the exported ODT document: those plugins must be modified to support the ODT output format. However, some plugins already support it.

See ODT render support for the list of plugins which already support export to ODT. On that page you can also add plugins to the list of plugins for which you wish ODT export to be supported.


The plugin is translated into English, German, Danish, French, Korean, Dutch and Japanese. Thanks a lot to the translators, new languages are very welcome!

Please use the DokuWiki Localization Tool.


To report bugs or suggest features, please use GitHub Issues. The author does not monitor this page.

1) In /lib/tpl/default/main.php, there are two divs that contain some buttons: <div class=“bar” id=“bar__top”> and <div class=“bar” id=“bar__bottom”>. Just insert the HTML code inside one of the two divs (left or right)
plugin/odt.txt · Last modified: 2015-10-27 05:02 by