You also could use the HTML widget, and do the RTF conversion using JavaScript and Regular Expressions. You should be able to find numerous samples on the Internet.
I've once made a sample that looked like this:
The following blockdata is assigned to a field that uses the HTML widget:
html1:blockdata ~
<!DOCTYPE html>
<html>
<body>
<p id="plainText"></p>
<script>
function convertToPlain(rtf) {
rtf = rtf.replace(/\\par[d]?/g, "");
rtf = rtf.replace(/\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?/g, "").trim();
rtf = rtf.replace(/\n/g, "<br/>")
window.unifaceTriggers('getPlainText', rtf);
}
</script>
</body>
</html>~
You then pass the RTF-text to the HTML widget like this:
$fieldhandle(HTML1)->$widgetoperation("JS:convertToPlain", RTF1)
And from the JavaScript function the extended trigger getPlainText is called that is defined for the HTML widget field:
trigger getPlainText
params
string plainTXT : IN
endparams
TXT1.DUM = $replace(plainTXT, 1, "<br/>", "%%^", -1)
end;- getPlainText trigger
My test form contains three fields:
- RTF1.DUMMY: Rich Edit Box widget with RTF-text
- HTML1.DUMMY: HTML widget (can be hidden)
- TXT1.DUM: normal Edit Box that will show the extracted text.
This should also work with Uniface 9.7.04. And the advantage of this approach is that you don't need any external dependencies.
I hope this helps.
Kind reagrds,
Daniel