0
votes

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?

2

2 Answers

3
votes

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()
0
votes

I ve found a way eventually so i am pasting it here:

var rich1:com.ibm.xsp.component.xp.XspInputRichText = getComponent("rich1");
var richVal:com.ibm.xsp.component.xp.XspOutputText = getComponent("richVal");

var r = rich1.getValueAsString();
var i = ddoc1.getDocument().getFirstItem("rch");
var dd = i.getMIMEEntity().getContentAsText();
richVal.setValue(dd+"----"+ r +"!!!!!"+ ddoc1.getItemValueString("rch"));

it seems to be working.