AODL.Document.Export.Html.HTMLStyleBuilder.GetColumnStyleAsHtml C# (CSharp) Метод

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

Gets the column style as HTML.
public GetColumnStyleAsHtml ( ColumnStyle columnStyle ) : string
columnStyle AODL.Document.Styles.ColumnStyle The column style.
Результат string
		public string GetColumnStyleAsHtml(ColumnStyle columnStyle)
		{
			string style		= "";

			try
			{
				if (columnStyle != null)
				{
					if (columnStyle.ColumnProperties != null)
					{
						if (columnStyle.ColumnProperties.Width != null)
						{
							string width	= columnStyle.ColumnProperties.Width;
							if (width.EndsWith("cm"))
								width		= width.Replace("cm", "");
							else if (width.EndsWith("in"))
								width		= width.Replace("in", "");

							try
							{
								double wd	= Convert.ToDouble(width, System.Globalization.NumberFormatInfo.InvariantInfo);
								string wdPx	= "";
								if (columnStyle.ColumnProperties.Width.EndsWith("cm"))
									wdPx	= SizeConverter.CmToPixelAsString(wd);
								else if (columnStyle.ColumnProperties.Width.EndsWith("in"))
									wdPx	= SizeConverter.InchToPixelAsString(wd);

								if (wdPx.Length > 0)
									style	= "width=\""+wdPx+"\" ";
							}
							catch(Exception ex)
							{
								if (this.OnWarning != null)
								{
									AODLWarning warning			= new AODLWarning("Exception while trying to build a column width.: "
										+ columnStyle.ColumnProperties.Width, ex);
									//warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
									//warning.OriginalException	= ex;
									OnWarning(warning);
								}
							}							
						}
					}
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML style string from a CellStyle.", ex);
			}

			return style;
		}