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

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

Gets the formated text as HTML.
public GetFormatedTextAsHtml ( FormatedText formatedText ) : string
formatedText AODL.Document.Content.Text.FormatedText The formated text.
Результат string
		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("<", "&lt;");
//						textContent		= textContent.Replace(">", "&gt;");
						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;
		}