Export can map paragraph and character styles in any word processing format that contains styles (such as Microsoft Word, RTF, or Folio Flat File) to user-defined markup.
To enable style mapping, you must indicate which paragraph and/or character styles are to be mapped, and define the starting and ending markup to be included in the <recipe>
and the ending markup </recipe>
. This would result in the output <recipe>
Brownies</recipe>
.
You can also use style mapping to control the look of the <p><div class=”rainbow”>
inserted at the front of the paragraph and markup of the form </div></p>
inserted at the end of the paragraph. “Rainbow” is a CSS style defined in an externally provided CSS file referenced at the top of the
Style mapping is enabled in the wordstyle.ini
template file. The HTML Export Getting Started page demonstrates the output resulting from a conversion using wordstyle.ini
. The Getting Started page, named htmstart.html
, is in the install
\htmlexport\docs
directory, where install
is the path name of the Export installation directory. The source documents used in the page are in the directory install
\testdocs
.
KVStyle
conflicts with other markup generated by HTML Export, the user-defined markup takes precedence.To map styles using the Java API
Create an instance of the StyleMapping
class. Using the object’s methods, specify the style mapping information. The information includes
the markup to be added to the beginning and end of a paragraph or character style.
the name of the word processing style (for example, “Heading 1”) to which style mapping applies. Style names are case sensitive.
the flag which defines instructions on how to process the content associated with a paragraph or character style. The flags are defined as constants in the Export class and listed in Flags for Defining Styles.
Call the setStyleMapping()
method of the Export
object and pass the StyleMapping
object.
To map styles using a template file
Use the KVStyle
parameter to specify how many styles are being mapped. For example, if there are nine mapped heading levels, add the following:
[KVStyle] NumStyles=9
For each style, there must be a [Style
X
]
entry that contains the markup that appears at the start and end of the defined style. For example, in the wordstyle.ini
sample file, the first heading level is defined as follows:
[Style1] StyleName=Colorful MarkUpStart=<div class="colorful"> MarkUpEnd=<!-- end of colorful --></div>
For each style, define the flag that applies. Flags define instructions on how to process the content associated with a paragraph or character style. They are defined as constants in the Export class and listed in Flags for Defining Styles.
Flags=KVSTYLE_HEADING3
A finished entry in a template file could look like this:
[KVStyle] NumStyles=3
[Style1] StyleName=Colorful MarkUpStart=<div class="Colorful"> MarkUpEnd=<!-- End of Colorful --></div> Flags=KVSTYLE_HEADING1
[Style2] StyleName=RedactPara MarkUpStart=<div class="RedactPara"> MarkUpEnd=<!-- End of RedactPara --></div> Flags=KVSTYLE_REDACT
[Style3] StyleName=Code MarkUpStart=<pre> MarkUpEnd=<!-- End of Code --></pre> Flags=KVSTYLE_PRE
Flag |
Description |
---|---|
The |
|
The By default, Export maps the heading style “Heading 1” to |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|