HTML & FreeTextBox

The following HTML is pulled using Aspose.

<FONT color=#0000ff><SPAN style="FONT-WEIGHT: bold; TEXT-DECORATION: underline">This is bold text.</SPAN></FONT>

I am using it with FreeTextBox to allow web users to edit the html. However, it does not allow the user to remove the font formatting, since it expects it in the following format

<FONT color=#0000ff><STRONG><U>This is bold text.</U></STRONG></FONT>

I would like the user be able to remove the formatting(bold/underline) of this text. How can I do that?

Hi

Thanks for your request. It is not quite clear for me what the problem is. Could you please be more specific?
Best regards,

Hello!
Thank you for your interest to HTML export.
I probably see your question without clarification. You’d like to get output that is accepted by FreeTextBox. Instead CSS styles there should be (or ), and . This is a known issue. We’ll let you know when it’s implemented.
As a workaround you can post-process the HTML output to replace CSS formatting with those HTML elements. This needs a bit of parsing and hopefully can be done with regular expressions.
Please feel free to ask anything else. And correct me if I’m not on the right way.
Regards,

Yes, that’s correct. Any idea when this will work(weeks, months or years)?
I will work on post-processing the HTML. Do you have any ready code that would post-process the HTML? Otherwise, I’ll work on that myself here.
Thank you.

Hi Melissa,
Thanks for your request. Currently I cannot provide you any reliable estimate regarding this issue. You will be notified as soon as it is resolved.
Regarding workaround, I think, you can use regular expressions to pre-process your HTML. For example, you can use code like the following:

string html = "This is bold text.";
// Search for style attributes in Span
Regex regex = new Regex("]*(style=[\"'][^\"']*(FONT-WEIGHT:\\s*(?[^\\s;]*))[^\"']*(TEXT-DECORATION:\\s*(?[^\\s;]*))[^\"']*[\"'])[^>]*>\\s*(?.*)\\s*", RegexOptions.Singleline | RegexOptions.IgnoreCase);
Match match = regex.Match(html);
// Format HTML elements starts and ends
string start = match.Groups["bold"].Value.ToLower() == "bold" ? "" : "";
start += match.Groups["decoration"].Value.ToLower() == "underline" ? "" : "";
start = string.IsNullOrEmpty(start) ? "" : start;
string end = match.Groups["decoration"].Value.ToLower() == "underline" ? "" : "";
end += match.Groups["bold"].Value.ToLower() == "bold" ? "" : "";
end = string.IsNullOrEmpty(start) ? "" : end;
// Replace html.
html = html.Replace(match.Value, start + match.Groups["innerhtml"] + end);
// Print HTML
Console.WriteLine(html);

Hope this helps.
Best regards,