AODL.Document.Content.Text.Header.GetHtmlStyle C# (CSharp) Method

GetHtmlStyle() private method

Gets the HTML style.
private GetHtmlStyle ( string headingname ) : string
headingname string The headingname.
return string
		private string GetHtmlStyle(string headingname)
		{
			try
			{
				string style			= "style=\"margin-left: 0.5cm; margin-top: 0.5cm; margin-bottom: 0.5cm; ";
				string fontname			= "";
				string fontsize			= "";
				string bold				= "";
				string italic			= "";

				if (this.Document is AODL.Document.TextDocuments.TextDocument)
				{
					AODL.Document.TextDocuments.TextDocument doc = (AODL.Document.TextDocuments.TextDocument)this.Document;
					XmlNode stylenode		= doc.DocumentStyles.Styles.SelectSingleNode("//style:style[@style:name='"+headingname+"']",
						this.Document.NamespaceManager);
					XmlNode propertynode	= null;

					if (stylenode != null)
						propertynode		= stylenode.SelectSingleNode("style:text-properties", this.Document.NamespaceManager);

					if (propertynode != null)
					{
						XmlNode attribute	= propertynode.SelectSingleNode("@fo:font-name", this.Document.NamespaceManager);
						if (attribute != null)
							fontname		= "font-family:"+attribute.InnerText+"; ";
					
						attribute	= propertynode.SelectSingleNode("@fo:font-size", this.Document.NamespaceManager);
						if (attribute != null)
							fontsize		= "font-size:"+attribute.InnerText+"; ";
					
						if (propertynode.OuterXml.IndexOf("bold") != -1)
							bold			= "font-weight: bold; ";

						if (propertynode.OuterXml.IndexOf("italic") != -1)
							italic			= "font-style: italic; ";
					}
				
					if (fontname.Length > 0)
						style		+= fontname;
					if (fontsize.Length > 0)
						style		+= fontsize;
					if (bold.Length > 0)
						style		+= bold;
					if (italic.Length > 0)
						style		+= italic;

					if (style.EndsWith(" "))
						style		+= "\"";
					else
						style		= "";

					return style;
				}
			}
			catch(Exception ex)
			{
				string exs = ex.Message;
			}
		
			return "";
		}