I am trying to remove all RTF formatting from a document but when I do so it seems to keep images and styling (i.e. the Fonts etc.)
Here is my Code:
function convertToPlain(rtf) {
rtf = rtf.replace(/\\par[d]?/g, "");
return rtf.replace(/\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?/g, "").replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
var body = input[0].text.toString();
var content = convertToPlain(body.toString());
var rq = <Test>{content}</Test>
next.xml = rq;
This does remove the RTF formatting but keeps all images and styling within the result.
Does anyone know how to remove the images and styling aswell?
Thanks