AODL.Document.Export.Html.HTMLContentBuilder.GetTabStopAsHtml C# (CSharp) Метод

GetTabStopAsHtml() публичный Метод

Gets the tab stop as HTML. Because of the fact that no tabstop html element exist, AODL will try to simulate this with a the non breaking line entity.
public GetTabStopAsHtml ( AODL.Document.Content.Text.TextControl.TabStop tabStop, int tabStopIndex, string htmlStringBefore, ParagraphStyle paragraphStyle ) : string
tabStop AODL.Document.Content.Text.TextControl.TabStop The tab stop.
tabStopIndex int The tab stop position from all tabstops from the textcollectio, /// where this tabstop belongs to.
htmlStringBefore string The complete html string before this tabstop.
paragraphStyle AODL.Document.Styles.ParagraphStyle The paragraph style from the enclosing paragraph.
Результат string
		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			= "&nbsp;";								
								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;
		}