For the last 9 - 12 months I have been doing a lot of work extracting data from Notes/Domino for use in other systems. This included Notes Rich Text data and so needed to convert it to a mixture of plain text and/or HTML. Unfortunately, the environment was running ND 9.0.1 FPx and upgrading to a more recent version was not an option, so I could not take advantage of some of the newer features such as the NotesRichTextItem convertToHTML function. In the end I used C API functions (called from Lotusscript) to convert any rich text items to HTML which worked great.

However, recently I needed more control over the HTML that was being generated when it came to fonts. I was already using the HTML conversion option "XMLCompatibleHTML=1" so I could have tried to process the generated HTML and make the required alterations, however my investigations also found the following two pages:

This was just what I needed, so gave it a try.

First, just setting FontConversion=1 did result in some differences, as illustrated in the following table.

Without FontConversion=1 With FontConversion=1
<font size="5" color="#ffffff" face="Arial">Document Header</font> <font size="4" color="#ffffff" face="Arial">Document Header</font>
<s>Strikethrough text</s> <font size="2" face="sans-serif"><s>Strikethrough text</s></font>
<tt>Default monospace text</tt> <tt><font size="2">Default monospace text</font></tt>
Default serif text <font size="2" face="serif">Default serif text</font>
Default sans-serif text <font size="2" face="sans-serif">Default serif text</font>
Default user interface text <font size="2">Default user interface text</font>
Default multilingual text <font size="2">Default multilingual text</font>

However, I really needed to try and replace the <font> tags with <span> tags that used style and/or class attributes. So I tried some of the other settings as documented, but they did not appear to work.

So I raised a ticket with HCL support and eventually got a list of new settings to try, but unfortunately they did not come with any instructions! So it was a case of trying each setting with a number of different values to see how it affected the HTML generated by Domino. Anyway, incase anyone else has a similar need, I hope the information below is useful.

First, there are a number of "spec" settings:

  • FontFaceMonospaceSpec
  • FontFaceSerifSpec
  • FontFaceSansSerifSpec
  • FontFaceSpecificSpec
  • FontColorSpec
  • FontSizeSpec
  • FontStyleBoldSpec
  • FontStyleItalicSpec
  • FontStyleUnderlineSpec
  • FontStyleStrikethroughSpec

These appear to use values 0, 1, 2, 4, 8, 16 and 32 to indicate how the HTML should be generated for each of the different settings, e.g.

  • 0 (none) - do not generate anything for the spec
  • 1 (native) - use the default HTML generation for the spec
  • 2 (outer span tag with style attribute) - surround any native tag with a <span> tag that specifies a style attribute, e.g. <span style="font-family: sans-serif ; ">........</span>
  • 4 (inner font tag with style attribute) - use a <font> tag with a style attribute inside any native tag, e.g. == <font style="font-family: sans-serif ; ">........</font>
  • 8 (native tag with style attribute - only applicable if there is a native tag) - use the native tag with a style attribute, e.g. <tt style="font-family: monospace">........</tt>
  • 16 (outer span tag with class attribute) - surround any native tag with a <span> tag that specifies a class attribute, e.g. <span class="domino-font-sansserif ">........</span>
  • 32 (native tag with class attribute - only applicable if there is a native tag) - use the native tag with a class attribute, e.g. <tt class="domino-font-monospace">........</tt>

Then there are a number of "tag" settings to configure if an extra tag should be used inside whatever is generated by the "spec" setting:

  • FontStyleBoldTag
  • FontStyleItalicTag
  • FontStyleUnderlineTag
  • FontStyleStrikethroughTag

The available options (at least in ND 9.0.1) appear to be:

  • 0 (none) - do not generate tag
  • 1 (native / default) - generate a native tag (<b> for bold, <u> for underline, <i> for italic and <s> for strikethrough)
  • 2 (span) - generate a <span> tag
  • 3 (em) - generate an <em> tag
  • 4 (strong) - generate a <strong> tag
  • 5 (mark) - generate a <mark> tag

So there are plenty of options / combinations available.

For my own needs, to replace <font> tags with <span> tags, it was a case of setting all the "spec" options to 2 and the "tag" options to 0.

e.g. without the settings, the resulting HTML was:

<font size="4" color="#ffffff" face="Arial">Document Header</font>

but with the additional HTML conversion options set I now get:

<span style="font-family: Arial ; font-size: 15pt ; color: #ffffff ; ">Document Header</span>

Whilst I am using these options with C API functions, I would hope they also work if specified via other methods such as:

  • Setting the DominoHTMLOptions notes.ini to control conversion at a server level
  • Adding a $$HTMLOptions field to a form to control conversion at a form level
  • Adding one or more $$HTMLOptions_fieldname field(s) to a form to control conversion at an individual field level

However, I have not yet had the opportunity to test these other methods.


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top