Search code examples
xpageslotus-noteslotus-dominorichtext

How can i get html content or bytes of a rich text field in XPages?


I have 2 text fields and 1 rich text field in an XPage. I have created a mechanism that whenever there is a change in at least one of these fields the document is autosaved as draft.

My problem with rich text field is that i can catch changes in text but i cant catch changes in text style (i.e: if i bold some characters).

So i want to get rich text content as html or bytes or anything that changes together with styling.

I want to compare the content stored in the document and the new content in the client so i need something like doc.getItemValueAsHTML() != richField.getValueAsHTML() ...

Any ideas?


Solution

  • The NotesXspDocument method getValue() followed by getHTML() gives you the HTML representation of the rich text field.

    So use your data source and call the getValue() and getHTML() methods using the name of the field as parameter. Example:

    document1.getValue("rtfield").getHTML()