Next: Customizing tables in ODT export, Previous: Working with OpenDocument style files, Up: Advanced topics in ODT export [Contents][Index]

#### 12.9.11.3 Creating one-off styles

There are times when you would want one-off formatting in the exported document. You can achieve this by embedding raw OpenDocument XML in the Org file. The use of this feature is better illustrated with couple of examples.

1. Embedding ODT tags as part of regular text

   You can inline OpenDocument syntax by enclosing it within ‘`@@odt:...@@`’ markup. For example, to highlight a region of text do the following:

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

   Hint: To see the above example in action, edit your `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

   You can add a simple OpenDocument one-liner using the `#+ODT:` directive. For example, to force a page break do the following:

       #+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

   You can add a large block of OpenDocument XML using the `#+BEGIN_ODT`…`#+END_ODT` construct.

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

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

Next: Customizing tables in ODT export, Previous: Working with OpenDocument style files, Up: Advanced topics in ODT export [Contents][Index]