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

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

Gets the paragraph as HTML.
public GetParagraphAsHtml ( Paragraph paragraph ) : string
paragraph AODL.Document.Content.Text.Paragraph The paragraph.
Результат string
		public string GetParagraphAsHtml(Paragraph paragraph)
		{
			string html					= "<p ";

			try
			{
				if (paragraph != null)
				{
					if (paragraph.StyleName != null)
						if (paragraph.StyleName != "Text_20_body" 
							&& paragraph.StyleName != "standard"
							&& paragraph.StyleName != "Table_20_body")
						{
							string style	= this.HTMLStyleBuilder.GetParagraphStyleAsHtml(paragraph.ParagraphStyle);							

							if (style.Length > 0)
								html		+= style;//+">\n";
							else
							{
								//Check against a possible common style
								IStyle iStyle		= paragraph.Document.CommonStyles.GetStyleByName(paragraph.StyleName);
								string commonStyle	= "";
								if (iStyle != null && iStyle is ParagraphStyle)
								{
									commonStyle		= this.HTMLStyleBuilder.GetParagraphStyleAsHtml(iStyle as ParagraphStyle);
									if (commonStyle.Length > 0)
										html		+= commonStyle;
									else
										html		= html.Replace(" ", "");
								}
								else
									html		= html.Replace(" ", "");
							}
						}
						else
						{
							html			= html.Replace(" ", "");
						}

					html					+= ">\n";

					string txtstyle	= "<span ";
					bool useTextStyle = false;
					if (paragraph.ParagraphStyle != null)
					{
						string tstyle	= this.HTMLStyleBuilder.GetTextStyleAsHtml(paragraph.ParagraphStyle.TextProperties);
						if (txtstyle.Length > 0)
						{
							txtstyle	+= tstyle+">\n";
							html		+= txtstyle;
							useTextStyle = true;
						}
					}
					else
					{
						//Check again a possible common style
						string commonstyle	= "";
						IStyle iStyle	= paragraph.Document.CommonStyles.GetStyleByName(paragraph.StyleName);
						if (iStyle != null && iStyle is ParagraphStyle)
						{
							commonstyle	= this.HTMLStyleBuilder.GetTextStyleAsHtml(((ParagraphStyle)iStyle).TextProperties);
							if (commonstyle.Length > 0)
							{
								txtstyle	+= commonstyle+">\n";
								html		+= txtstyle;
								useTextStyle = true;
							}
						}
					}

					////
					string mixedCont	= this.GetMixedContentAsHTML(paragraph.MixedContent, paragraph.ParagraphStyle);
			
					////
					if (mixedCont.Length > 0)
						html			+= mixedCont+"&nbsp;";
					else
						html			+= "&nbsp;";

					if (!html.Equals("<p "))
						if (useTextStyle)
							html				+= "</span>\n</p>\n";
						else
							html				+= "</p>\n";
					else
						html				= "";

			if (html.Equals("<p >"))
				html				= "";
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML string from a Heading object.", ex);
			}			

			return html;
		}