1

I have the following richtext (from flex) that I need to covert to plain text and export this to excel. Although html can be exported to excel, the problem is, for bulleted list, it's trying to merged 2 column cells... and for paragraphs, it's merging multiple rows.

<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#000000" LETTERSPACING="0" KERNING="0">Hello</FONT></P>
<TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B><I><U>Working</U></I></B></FONT></LI></TEXTFORMAT>
<TEXTFORMAT LEADING="2"><LI><FONT FACE="Verdana" SIZE="10" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B><I><U>numbers</U></I></B></FONT></LI></TEXTFORMAT>

I need it to be just plain text, if possible retaining the line space and some formatting like bold when i export to excel so the whole thing fits in inside one cell. This is how it looks like in html:

Hello

  • Working
  • numbers
  • I tried replacing it with regex but it doesn't work. Please advise.

    iPhoneJavaDev
    • 821
    • 5
    • 33
    • 78
    • Insert into an element (div?) and get the [*textContent*](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent). – RobG Jul 10 '14 at 08:46
    • i did that but nothing happens, it returns blank – iPhoneJavaDev Jul 10 '14 at 08:46
    • i need to convert it without the browser – iPhoneJavaDev Jul 10 '14 at 08:54
    • You need a parser. If you can't use a browser's built–in parser, or say the [*DOMParser*](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser), you'll need to parse it yourself (BTW, there's a missing closing *textformat* tag, but that's not the problem). – RobG Jul 10 '14 at 08:58
    • 1
      Please Refer to this Stack Overflow [Post](http://stackoverflow.com/questions/10403678/converting-from-rich-text-format-to-plain-text-problems) – Sunil Hari Jul 10 '14 at 13:00

    0 Answers0