public string GetITextCollectionAsHtml(ITextCollection iTextCollection, ParagraphStyle paragraphStyle)
{
string html = "";
int tabStopCnt = 0;
try
{
if (iTextCollection != null)
{
foreach(IText iText in iTextCollection)
{
//determine type
if (iText is SimpleText)
{
string textContent = iText.Node.InnerText;
html += this.ReplaceControlNodes(textContent);
}
else if (iText is FormatedText)
html += this.GetFormatedTextAsHtml(iText as FormatedText);
else if (iText is WhiteSpace)
html += this.GetWhiteSpacesAsHtml(iText as WhiteSpace);
else if (iText is TabStop)
{
html += this.GetTabStopAsHtml(iText as TabStop, tabStopCnt, html, paragraphStyle);
tabStopCnt++;
}
else if (iText is XLink)
html += this.GetXLinkAsHtml(iText as XLink);
else if (iText is LineBreak)
html += this.GetLineBreakAsHtml();
else if (iText is UnknownTextContent)
html += this.GetUnknowTextContentAsHtml(iText as UnknownTextContent);
else
//this should never happens, because all not implemented elements
//are unknwon content
if (OnWarning != null)
{
AODLWarning warning = new AODLWarning("Finding total unknown text content. This should (could) never happen.");
//warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
OnWarning(warning);
}
}
}
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to build a HTML string from an ITextCollection.", ex);
}
return html;
}