convert html to text

Hi,

I have a text_area field and I like to be able to format the content, so html or rtf seems to be the most convenient display type. But now I like to convert the formatted content to text for export reasons. Is there any way to do it?

Try this, it should help:

//Returns the escaped markup text (HTML/XML)
var escapedText = utils.stringEscapeMarkup('<html><body>escape me</body></html>')

Hi Nicola,

sorry it doesn’t help. All what I get out is this:

“escape me”

What I would like to see is this

this sould be bold
and this maybe italic

So you just want the plain text without formatting, right?

To get this, make sure your the htmlarea has a name and do:```
elements.myname.getAsPlainText();

Hi Joas,

nop, I want the formatted text. Thats why I have an html area, so that the user can format the text and export it.

irenem:
Hi Joas,

nop, I want the formatted text. Thats why I have an html area, so that the user can format the text and export it.

Ok, but export it in which format? The standard for formatted text is HTML or RTF so to which one do you want to convert it?

Hmmm, I don’t really get the problem then. If you want to keep the formatting, why can’t you just use the html from the dataprovider?

I use the wordplugin from it2b. If I replace the bookmark with the content of the html-area I get the whole code.

<html>
  <head>

  </head>
  <body>
    <p style="margin-top: 0">
      Zandweg 69 B
    </p>
    <p style="margin-top: 0">
      3454 JW <b>De Meern</b>
    </p>
  </body>
</html>

What I want to see is this:

zandweg 69b
3454JW De Meern

if it’s only to modify (some) text to bold, you can use plugins.it2be_word.toggleBold() for that with the Word plug.
I’dd say use the getAsPlainText() function and apply plugins.it2be_word.toggleBold() .

Which version do you use?

If it is the IT2BE Word Plug-in for Servoy 4 Eclipse the by Karel suggested methods will not work due to new libraries.

Hi Marcel,

The version for Servoy 4 is the version I use. Is there any other way to do this? Or will it be possible in the future?

See my reply on our forum irene: http://www.it2be.com/index.php/forum?ta … 1433#p1433

I see several ways to solve this, depending on what you need to do.