Not sure if my problem is related to the following post TextConverter import/export HTML
In this he mentions:
Don't export the configuration.textFlowInitialFormat to the HTML format. textFlowInitialFormat is something like the default setting of the browser and in my opionen should not be attached to the content. It considerably bloats the export. TEXT_LAYOUT_FORMAT ignores textFlowInitialFormat in the tree (and seems to put it into attributes of the TextFlow element). This is a little bit better and I guess, it is done to have all settings stored into export. However, at least for HTML elements, I'd like to have textFlowInitialFormat ignored.
I'm trying to export text from a spark TextArea component to HTML and save it in our database. The issue I'm having is that the application used to edit this text needs it formatted differently than the application that will display the text (mainly font size and color.)
I would like to have it exported as HTML to retain any links, paragraph breaks, etc.
The HTML string I get back from calling
TextConverter.export(tf, TextConverter.TEXT_FIELD_HTML_FORMAT, ConversionType.STRING_TYPE).toString();
<FONT FACE="Arial" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="1">
regardless of the fact that my TextAreay color is set to #CCCCCC and fontSize="10";
So the question is, how can do this? I need to have the HTML text contain things like paragraph breaks, but I don't want the formatting / styles. The application that loads the HTML text should define this.
Beau N. Brewer
The way the code is set up today, you will always get a <font> element on the paragraph. I think this is backwards compatible with how
TextField exports to HTML. (Note that TLF's"HTML" filter is mainly aimed at compatibility with TextField's HTML).
Thanks Robin for the ideas. I was hoping TLF would provide a easy way to remove formatting / styles before using the TextConverter to export the HTML, but that still wouldn't help if the <font> tag is always exported.
As far as the HTML containing a different font and font color than I have set on the component... is that expected as well?
I've had the same odd experience. For instance, if I set a style using MyTextArea.setStyle("fontSize", 56) and export it to HTML the font tag will say size="12" but it will show as 56px when drawn in the browser. Very weird.
But that's not the real problem with the TextConverter.export method, the real problem is that it surrounds every paragraph with a font tag, even though I have also done so through using TextLayoutFormat for the entire paragraph's range. On export I end up with two font tags around every paragraph, the one the TextConverter adds and (inside of that, luckily) the one that I have set.
Now I have to write custom code that goes back through all the paragraphs and "breaks" them out of the extra font tag...which is entirely unnecessary.
I hope this gets fixed in the future. Perhaps like this: TextConvert.export(source, format, conversionType, *addHtmlTags:Boolean*);
Europe, Middle East and Africa