Next: , Previous: , Up: Advanced topics in ODT export   [Contents][Index]


Creating one-off styles

Creating one-off styles

The ODT export back-end can read embedded raw OpenDocument XML from the Org file. Such direct formatting are useful for one-off instances.

  1. Embedding ODT tags as part of regular text

    Enclose OpenDocument syntax in ‘@@odt:...@@’ for inline markup. For example, to highlight a region of text do the following:

    @@odt:<text:span text:style-name="Highlight">This is highlighted
    text</text:span>@@.  But this is regular text.
    

    Hint: To see the above example in action, edit the styles.xml (see Factory styles) and add a custom ‘Highlight’ style as shown below:

    <style:style style:name="Highlight" style:family="text">
      <style:text-properties fo:background-color="#ff0000"/>
    </style:style>
    
  2. Embedding a one-line OpenDocument XML

    The ODT export back-end can read one-liner options with #+ODT: in the Org file. For example, to force a page break:

    #+ODT: <text:p text:style-name="PageBreak"/>
    

    Hint: To see the above example in action, edit your styles.xml (see Factory styles) and add a custom ‘PageBreak’ style as shown below.

    <style:style style:name="PageBreak" style:family="paragraph"
                 style:parent-style-name="Text_20_body">
      <style:paragraph-properties fo:break-before="page"/>
    </style:style>
    
  3. Embedding a block of OpenDocument XML

    The ODT export back-end can also read ODT export blocks for OpenDocument XML. Such blocks use the #+BEGIN_EXPORT odt#+END_EXPORT constructs.

    For example, to create a one-off paragraph that uses bold text, do the following:

    #+BEGIN_EXPORT odt
    <text:p text:style-name="Text_20_body_20_bold">
    This paragraph is specially formatted and uses bold text.
    </text:p>
    #+END_EXPORT