DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:odt
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


-
-
+
+plugin:odt [2013-01-28 16:04]
Klap-in
@@ Line -1 +1,281 @@ removed created
 ====== OpenOffice.org Export ======
 
 ---- plugin ----
 description: Exports a page to the Open Document format used by OpenOffice.org and other word processors
 author     : Andreas Gohr, Aurélien Bompard
 email      : andi@splitbrain.org, aurelien@bompard.org
 type       : render, syntax
 lastupdate : 2010-10-30
 compatible : 2007-06-26 and later
 depends    : 
 conflicts 
 similar    : 
 tags       : export, odt, pdf
 
 downloadurl: http://aurelien.bompard.org/projects/files/dokuwiki-odt/dokuwiki-odt-20101030.zip
 sourcerepo : http://gitorious.org/dokuwiki-odt
 bugtracker : http://aurelien.bompard.org/projects/dokuwiki-odt
 donationurl: http://flattr.com/thing/47961/DokuWiki-ODT-plugin
 ----
 
 This plugin allows you to export a page to the [[wp>OpenDocument]] format used by [[http://www.openoffice.org|OpenOffice.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 [[andi@splitbrain.org|Andreas Gohr]], and is now developed and maintained by [[http://aurelien.bompard.org|Aurelien Bompard]]. If you have any requests (bugs, features, etc.), please use [[http://aurelien.bompard.org/projects/dokuwiki-odt|the plugin's tracker]], the author does not monitor this page.
 
 
 ===== Download =====
 
 [[http://flattr.com/thing/47961/DokuWiki-ODT-plugin|{{ http://api.flattr.com/button/button-static-50x60.png|Flattr this}}]]
 
 Latest release: [[http://aurelien.bompard.org/projects/files/dokuwiki-odt/dokuwiki-odt-20101030.zip|dokuwiki-odt-20101030.zip]] ([[http://aurelien.bompard.org/projects/files/dokuwiki-odt/dokuwiki-odt-20100812.zip.asc|signature]])
 
 Changes:
     * Bugfixes
     * Table rowspan support (closes: [[http://aurelien.bompard.org/projects/dokuwiki-odt/ticket/4|#4]])
     * Ukrainian translation (by Oleksiy Zagorskyi)
     * Remove empty paragraphs from output
     * Download external images
 
 Older releases are available [[http://aurelien.bompard.org/projects/files/dokuwiki-odt/|on this webpage]].
 
 The development can be [[http://gitorious.org/dokuwiki-odt|tracked on Gitorious]]:
 
 {{rss>http://gitorious.org/dokuwiki-odt.atom date}} 
 
 This plugin works with DokuWiki 2007-06-26 and later.
 ===== Usage =====
 
 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|template]].
 
 Use the following to add another button in the upper or bottom button row of the default template((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) ))
 
 <code>
 <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>
 </code>
 
 Or use this for a simple 16x16 icon somewhere in your template:
 
 <code>
   <a href="<?php echo exportlink($ID, 'odt')?>"><img src="<?php echo DOKU_BASE?>lib/images/fileicons/odt.png" alt="ODT Export" /></a>
 </code>
 
 ===== Customizing =====
 
 There are three ways of customizing how the output will look like :
   * Modify the export of the [[wiki:syntax|wiki:syntax]] page. Then 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.
   * 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.
   * 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:
 <code>
   {{odt>template:your template file name.odt}}
 </code>
 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.
 
 
 ===== Other 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.
 
 ^Plugin ^ Description ^
 |[[plugin:Fields]] | User-defined fields support -- Together with the [[plugin:fields|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 [[plugin:fields|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.|
 |[[Notes]] | The nice-looking notes provided by the [[plugin:note|note]] plugin are exported to ODT. You need at least version 2008-02-17 of the note plugin for ODT support.|
 |[[Include]] | The [[plugin:include|include]] plugin will let you generate a single ODT file from multiple wiki pages, just like for XHTML. Support for the ODT format is included in the latest release.|
 |[[Math2]] | The [[plugin:math2|math2]] plugin will let you insert mathematical formulas in a wiki page. Support for the ODT format which should be [[plugin:math2#discussion|imminent]]. In the meantime, you can apply [[plugin:math2#odt|this code]]. |
 |[[LaTeX]] | The [[plugin:latex|LaTeX]] rendering plugin also will let you insert mathematical formulas in a wiki page, using a back-end LaTeX compiler. Support for ODT export is now included.|
 |[[Chem]] | The [[plugin:chem]] plugin formats a molecular formula by using %%<chem>%% tag. The latest version supports to export ODT format.|
 |[[Color]] | The [[plugin:color#version_with_odt_renderer_support|color]] color plugin is really a demo of a simple a syntax plugin. A version has been produced including support for the ODT format|
 |[[DivAlign2]] | Hi. Just wanted you to know that I've made one of my plugins, [[plugin:divalign2]] (//paragraph alignment//) compatible with ODT plugin output. I should also let you know by mail...  --- //[[luis.machuca@gulix.cl|Luis Machuca B.]] 2009/08/22 06:26//|
 |[[nspages]] | The [[nspages]] plugin creates TOC of namespaces. The latest version supports the ODT format.|
 
 See also [[plugin:odt:rendersupport|ODT render support]] for howto and current initiatives.
 
 ===== Translations =====
 
 The plugin is translated into English, German, French, Italian, Spanish, Japanese, Russian and Chinese. Thanks a lot to the translators, new languages are very welcome!
 
 
 ===== Bugs =====
 
 To report bugs or suggest features, **please** use [[http://aurelien.bompard.org/projects/dokuwiki-odt|the plugin's tracker]]. The author does not monitor this page.
 
 
 ===== Discussion =====
 ==== Language-specific styles ====
 <code diff>
 diff -ur odt.old/renderer.php odt/renderer.php
 --- odt.old/renderer.php 2010-10-30 11:25:54.000000000 +0200
 +++ odt/renderer.php 2011-02-15 13:52:26.000000000 +0100
 @@ -307,6 +307,9 @@
      function document_end_scratch(){
          $autostyles = $this->_odtAutoStyles();
          $userfields = $this->_odtUserFields();
 +        foreach ($this->extrastyles as $stylename=>$stylexml) {
 +            $extrastyles .= $stylexml;
 +        }
  
          // add defaults
          $this->ZIP->add_File('application/vnd.oasis.opendocument.text', 'mimetype', 0);
 @@ -364,6 +367,7 @@
  
          $value = io_readFile(DOKU_PLUGIN.'odt/styles.xml');
          $value = str_replace('<office:automatic-styles/>', $autostyles, $value);
 +        $value = str_replace('<office:extra-styles/>', $extrastyles, $value);
          $this->ZIP->add_File($value,'styles.xml');
  
          // build final manifest
 @@ -910,7 +914,16 @@
  
      function _highlight($type, $text, $language=null) {
          global $conf;
 -        $style_name = "Source_20_Code";
 +        if($language!=''){
 +            $style_name = "Code $language";
 +            $this->extrastyles["Code $language"] = '
 +    <style:style style:name="'."Code $language".'" style:display-name="Code '.$language.'" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">
 +        <style:paragraph-properties fo:padding="0.05cm" style:shadow="none" fo:border="0.002cm solid #8cacbb" fo:background-color="#f7f9fa"/>
 +    </style:style>
 +            ';
 +        } else{
 +            $style_name = "Source_20_Code";
 +        }
          if ($type == "file") $style_name = "Source_20_File";
  
          if (is_null($language)) {
 diff -ur odt.old/styles.xml odt/styles.xml
 --- odt.old/styles.xml 2010-10-30 11:25:54.000000000 +0200
 +++ odt/styles.xml 2011-02-15 13:45:09.000000000 +0100
 @@ -113,6 +113,7 @@
          <style:style style:name="Graphics" style:family="graphic">
              <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
          </style:style>
 +    <office:extra-styles/>
          <text:outline-style>
              <text:outline-level-style text:level="1" style:num-format="">
                  <style:list-level-properties text:min-label-distance="0.381cm"/>
 
 </code>
 ==== General Use ====
 
 Will someone write a short example how to **integrate export button into template**? I tried to do it myself, but CSS, PHP, HTML are unfamiliar for me. Template consist of 9 files of different types. Which file should be modified? Thanks. --- //[[publicmail@mail.ru|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 [[:devel:templates|this page]].
 >  --- //[[christophegragnic@yahoo.fr|Grahack]] 2008-03-02 10:02//
 
 ----
 
 It is possible to **import ODT 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 Writer's Tools for OOo has removed DokuWiki conversion.
 
 ----
 
 How can I get the **page title** to be included in the template, not just as the name of the file ? ---//[[sean.escriva@gmail.com|SME]] 2008/06/03//
 
 ----
 
 **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@ufz.de|Werner Flamme]] 2008/09/04 21:29 CEST//
 
 ----
 
 Thanks for the GREAT plugin. works out of the box in no time! Is there any means of **specifying the template** in the link rather than the wiki code?  I'd prefer a single modification to my template, like
 <?php echo exportlink($ID, 'odt&template=your_template_file name.odt')?> rather than having to put the required line in all pages... and having users messing with it. ---//[[berteh@hotmail.com|Berteh]] 2008/10/22//
 >for now I hacked the plugin to add a "template" option in config: hope this helps, feel free to correct this code if you spot errors. ---//[[berteh@hotmail.com|Berteh]] 2008/10/22//
 1. add to odt/conf/default.php
   $conf['tpl_template'] = 'my_custom_template.odt'; //comment this line to not use any template
 2. add to odt/conf/metadata.php
   $meta['tpl_template'  = array('string');
 3. edit function document_end() in odt/renderer.php: (line 250)
   function document_end(){
   +      if (!$this->template) { // if no template chosen in current page, get default template from config
   +           $this->template=$this->getConf("tpl_template");
   +      }
   +
          if ($this->template) { // template chosen
 
 > That's a good idea, I should probably include that at some point.  --- //[[aurelien@bompard.org|Aurélien Bompard]] 2010/04/04 11:21//
 
 ** ODT export error **\\ 
 I bumped into the problem that ODT export stopped working for me, even the pdf export stopped working.
 After a long time I found the error.
 In the global apache2 php.ini file mbstring.func_overload was set to 7 by mantis bug tracker
 (mbstring.func_overload = 7).\\ 
 Dokuwiki ODT export does not like this setting.
 It has to be mbstring.func_overload = 0 or if you wish to set it only for one site use .htaccess (php_value mbstring.func_overload 0).
 Sören
 \\
 \\
 **Modifying Table Properties**
 We are trying to get tables not to break on page boardes - the progress is in here: http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=34773&p=159918#p159918
   * **UPDATE** This one is finaly fixed! We now have a modified renderer.php which generates non breaking tables all the time, I am so happy :D Thanks to one of the moderators of the OpenOffice Forums :D Get the renderer.php here: http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=34773&p=160037#p160037
 
 ==== Non-ASCII pagename in Windows cannot export ====
 
 It's because Windows doesn't support unicode file name so temp directories cannot be created. Change the temp file name to md5 can solve the problem.
 
 <code diff>
 === (+2,-2) renderer.php ===
 @@ -382,7 +382,7 @@
          } else {
              $temp_dir = $conf['savedir'].'/cache/tmp'; // version <= 20070626
          }
 -        $this->temp_dir = $temp_dir."/odt/".str_replace(':','-',$ID);
 +        $this->temp_dir = $temp_dir."/odt/".md5($ID);
          if (is_dir($this->temp_dir)) { $this->io_rm_rf($this->temp_dir); }
          io_mkdir_p($this->temp_dir);
 </code>
 
  --- [[user>danny0838]] //2011/01/26 14:57//
 
 ==== Extra space after linebreak ====
 
 If you use %%\\\n%% as single linebreak, there would be an extra space after the linebreak in the output odt. This can be fixed by adding an instruction in the document_end funciton in the renderer.php:
 
 <code diff>
         $this->doc = preg_replace('#<text:p[^>]*>\s*</text:p>#', '', $this->doc);
 +        $this->doc = preg_replace('#<text:line-break/>\n+#', '<text:line-break/>', $this->doc);
 </code>
 
  --- [[user>danny0838]] //2011/01/28 04:51//
 
 ==== Does not export text descriptions for file links ====
 
 It would be great if this plugin could also export text descriptions that link to files:
 
 <code>
 [[ks:somepage|This text describing an internal link is exported to ODT]]
 
 [[http://www.google.com|This text describing an external link is also exported to ODT]]
 
 {{:somefile.pdf|This text describing a link to a document is NOT exported to ODT}}
 </code>
 
  --- //[[egil@digibrev.net|Eagle]] 2011-08-29 15:42//
plugin/odt.txt · Last modified: 2024-03-06 12:22 by thomas-schaefer-nh

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki