public string GetTabStopAsHtml(TabStop tabStop, int tabStopIndex, string htmlStringBefore, ParagraphStyle paragraphStyle)
{
//simulate a tabstop in html
string htmlTab = " ";
string html = "";
try
{
if (paragraphStyle != null)
if (paragraphStyle.ParagraphProperties != null)
if (paragraphStyle.ParagraphProperties.TabStopStyleCollection != null)
if (paragraphStyle.ParagraphProperties.TabStopStyleCollection.Count-1 <= tabStopIndex)
{
TabStopStyle tabStopStyle = paragraphStyle.ParagraphProperties.TabStopStyleCollection[tabStopIndex];
string leadingChar = " ";
if (tabStopStyle.LeaderText != null)
leadingChar = tabStopStyle.LeaderText;
string[] grabInt = tabStopStyle.Position.Split('.');
if (grabInt.Length == 2)
{
double position = Convert.ToDouble(grabInt[0]);
//expecting that one displaying character will ~ .5cm
if (htmlStringBefore != null)
{
for(int i=0; i<htmlStringBefore.Length; i++)
position -= 0.5;
}
if (position > 0.5)
for(double i=0; i<position; i+=0.25)
html += leadingChar;
}
}
}
catch(Exception ex)
{
if (OnWarning != null)
{
AODLWarning warning = new AODLWarning("Exception while trying to build a simulated html tabstop.", ex);
//warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
//warning.OriginalException = ex;
OnWarning(warning);
}
}
if (html.Length == 0)
html = htmlTab;
return html;
}