public string GetFormatedTextAsHtml(FormatedText formatedText)
{
string html = "<span ";
try
{
if (formatedText.TextContent != null)
{
string textStyle = "";
if (formatedText.TextStyle != null)
textStyle = this.HTMLStyleBuilder.GetTextStyleAsHtml(formatedText.TextStyle.TextProperties);
if (textStyle.Length > 0)
{
html += textStyle;
}
else
{
//Check again a possible common style
string commonstyle = "";
IStyle iStyle = formatedText.Document.CommonStyles.GetStyleByName(formatedText.StyleName);
if (iStyle != null && iStyle is TextStyle)
{
commonstyle = this.HTMLStyleBuilder.GetTextStyleAsHtml(((TextStyle)iStyle).TextProperties);
if (commonstyle.Length > 0)
html += commonstyle;
}
}
html += ">\n";
string textContent = this.GetITextCollectionAsHtml(formatedText.TextContent, null);
if (textContent.Length > 0)
{
// textContent = textContent.Replace("<", "<");
// textContent = textContent.Replace(">", ">");
html += textContent;
}
}
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to build a HTML string from a FormatedText object.", ex);
}
if (!html.Equals("<span "))
html += "</span>\n";
else
html = "";
return html;
}