It's better when it's simple
Learn about DokuWiki
Advanced Use
Corporate Use
Our Community
Follow us on Facebook, Twitter and other social networks.
Compatible with DokuWiki
Exports a page to the Open Document format used by OpenOffice.org and other word processors
Tagged with export, odt, pdf
This plugin allows you to export a page to the OpenDocument format used by OpenOffice.org, LibreOffice.org and other word processors. This is especially useful when you need to print or to give a single page to a customer (Hint: OpenOffice.org 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:
To make a single page exportable you can add the following macro to the page:
~~ODT~~
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?>" /> </div> </form>
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 </button> <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?>" /> </div> </form>
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):
This is an example for passing the setting orientation as a URL request parameter:
https://www.dokuwiki.org/plugin:odt?orientation=landscape&do=export_odt
The same works for syntax tags. The syntax tags for settings always have the same format:
{{odt>setting:value}}
Here again the example for the setting orientation:
{{odt>orientation:landscape}}
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. |
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:
{{odt>page:format,orientation,margin_top,margin_right,margin_bottom,margin_left}}
The following example sets the page format A3, orientation landscape and all margins to 1 centimeter.
{{odt>page:A3,landscape,1,1,1,1}}
You can also omit parameters that you do not want to change, e.g.:
{{odt>page:A3,landscape}}
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:
{{odt>format:A3}} {{odt>format:A4}} {{odt>orientation:portrait}} {{odt>orientation:landscape}} {{odt>margin_top:1}} {{odt>margin_right:2}} {{odt>margin_left:3}} {{odt>margin_bottom:4}}
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:
{{odt>toc}}
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:
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):
{{odt>toc:title=Content;leader_sign=.;indents=0,0.5,1;pagebreak=true; styleL1="font-weight:bold;";styleL2="font-style:italic;"; styleL3="font-style:normal;";}}
{{odt>toc:title=Content;leader_sign=_;indents=0,2,2;pagebreak=false; styleL1="font-weight:bold;";styleL2="font-style:normal;"; styleL3="font-style:normal;";}}
These tags enable or disable link creation just like the configuration setting. Here is the syntax:
{{odt>disablelinks}} {{odt>enablelinks}}
Changes:
Latest Release:
Development master branch:
Release 20101030 with Default Template Support: dokuwiki-odt-20140210.
More older releases are available