odt plugin by Andreas Gohr, Aurélien Bompard
Exports a page to the Open Document format used by Open Office and other word processors
Last updated on 2008-05-05. Provides Syntax, Render.
Compatible with DokuWiki 2007-06-26 and later.
This plugin allows you to export a page to the OpenDocument format used by Open Office and other word processors. This is especially useful when you need to print or to give a single page to a customer (Hint: Open Office can also export to PDF).
This plugin was initially developed by Andreas Gohr, and is now maintained by Aurelien Bompard. Feel free to contact me by mail if you have questions, since I'm not monitoring this page.
Alternatively get the plugin through Git with this command: ”git clone http://aurelien.bompard.org/projects/dokuwiki/odt.git”.
This plugin works with Dokuwiki 2007-06-26 and later.
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.
Use the following to add another button in the upper or bottom button row of the default 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>
There are three ways of customizing how the output will look like :
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 defaut, 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).
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.
Together with the fields plugin, you can store data in user-defined fields in your page, and recall this data from anywhere in your document (even in the headers and footers). See the fields plugin documentation page for more information.
In OpenOffice, user-defined fields are accessible using the Insert menu → Field → Other, “Variables” tab, and “User fields” section on the left.
This is very useful for document references, project names, etc.
The nice-looking notes provided by the note plugin are exported to ODT. You need at least version 2008-02-17 of the note plugin for ODT support.
The include plugin will let you generate a single ODT file from multiple wiki pages, just like for XHTML. Support for the ODT format will be included in the next release, which should be imminient. In the meantime, you can use this patch.
The math2 plugin will let you insert mathematical formulae in a wiki page. Support for the ODT format which should be imminent. In the meantime, you can apply this code.
The chem plugin formats a molecular formula by using <chem> tag. The latest version supports to export ODT format.
The plugin is translated into English, German, French and Italian. Thanks a lot to the translators, new languages are very welcome !
Hi ! Thank for this tremendous plug-in
i'm trying to use the {odt>template:file.odt} syntax. Le plugin finds the template file but i get the following error
Fatal error: Cannot instantiate non-existent class: directoryiterator in /some/path/dokuwiki/inc/ZipLib.class.php on line 67
any idea ?
— daamien
Are you using PHP4 ? This feature in the plugin requires at least PHP5. — Aurélien Bompard 2008/08/07 22:18
It is possible to IMPORT odt back into Dokuwiki? Yes, have a look on http://www.linux.com/articles/41545
— OOo User 2008-02-19 09:52
Though, it looks like the latest version of writertools for OOo has removed dokuwiki conversion.
Will someone write a short example how to integrate export button into template? I tried to do it myself, but CSS, PHP, HTML are unfamilar for me. Template consist of 9 files of different types. Which file should be modified? Thanks.
— Alexander 2008-02-29 17:57
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 provided in this page once and inside one of the two divs (left or right). If it doesn't please you, try another place.
Now it is wise not to edit this default template file but proceed as stated on this page.
— Grahack 2008-03-02 10:02
In a Dokuwiki-installation version 2008-05-05 I encounter following small problem: If dokuwiki creates from combined characters some extended html characters (e.g. →, –, —, ←), my OpenOffice 2.3 reports “format error discovered in the file in sub-document content.xml at 65,0 (row,col)”. If such characters are not in the text, no problem (beside this small problem, a really nice plugin) while updating, I didn't update entities.conf … with utf8 thingies instead of html-entities it does works
—Hella 2008-05-20 00:32
I've got odt working, but it won't export pages included using plugin:include. I've just downloaded include, and it seems to have the patch already applied. Is there something else I need to do? Thanks! —Chris 2008-05-28 17:10
There's just been discovered something else missing in the include plugin in order to get it work with the odt plugin. We're impleting it soonish (1-2 days) - I'll leave a note here once it's done! — Michael Klier 2008/05/28 23:43
I don`t want to be pressing or anything, but is there any update on the include plugin? – Dolphin
Scheduled on my TODO list for this weekend(promised + sorry for the delay). — Michael Klier 2008/06/13 10:40
Done! You can fetch the plugin from the download link at include. — Michael Klier 2008/06/15 16:16
Downloaded and working! Thanks a lot for your effort – Dolphin
Is there a way to properly export pages using plugin:source? —Sylvain Bonneau 2008/05/30
I will probably be able to tweak the source plugin to work with the ODT format, however I don't think I'll be able to make the syntax highlighting work. The file will be included verbatim, in a “Preformatted” block. Is that OK with you ? Feel free to email me, I don't monitor this page (hell, we're coworkers !!! :) ) — Aurélien Bompard 2008/08/07 22:21
Great work on this plugin. I can't seem to get it to save the formatting from the wiki, ie bold, italic, headings… Is there something I need to do in my template to get it to do that? Also how can I get the page title to be included in the template, not just as the name of the file ? —SME 2008/06/03
Thanks for the plugin - has anyone been able to get it to export with an OTT template, not just using particular styles or a style set? –kathryn
Thanks for this plugin! Downloaded, added the button in ACH template and works
– at least now, and I'm not using the template feature yet
— Werner Flamme 2008/09/04 21:29 CEST
I can't open the result of the export. Both OpenOffice and StarOffice report, that the file is corrupted. Afer repairing them, they are empty. Any suggestions? Stephan Lamprecht
/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)