// constructor defining a base table with default attributes public HtmlTableProperty(bool htmlDefaults) { //define base values CaptionText = string.Empty; CaptionAlignment = HorizontalAlignOption.Default; CaptionLocation = VerticalAlignOption.Default; TableAlignment = HorizontalAlignOption.Default; // define values based on whether HTML defaults are required if (htmlDefaults) { BorderSize = 2; TableRows = 3; TableColumns = 3; TableWidth = 50; TableWidthMeasurement = MeasurementOption.Percent; CellPadding = 1; CellSpacing = 2; } else { BorderSize = 0; TableRows = 1; TableColumns = 1; TableWidth = 0; TableWidthMeasurement = MeasurementOption.Pixel; CellPadding = 0; CellSpacing = 0; } }
/// <summary> /// Constructor defining a base table with default attributes /// </summary> public HtmlTableProperty(bool htmlDefaults) { //define base values CaptionText = string.Empty; CaptionAlignment = HorizontalAlignOption.Default; CaptionLocation = VerticalAlignOption.Default; TableAlignment = HorizontalAlignOption.Default; // define values based on whether HTML defaults are required if (htmlDefaults) { BorderSize = 2; TableRows = 3; TableColumns = 3; TableWidth = 50; TableWidthMeasurement = MeasurementOption.Percent; CellPadding = 1; CellSpacing = 2; } else { BorderSize = 0; TableRows = 1; TableColumns = 1; TableWidth = 0; TableWidthMeasurement = MeasurementOption.Pixel; CellPadding = 0; CellSpacing = 0; } }
/// <summary> /// Convert from integer or string signifier to the internal enumerated type. /// Command line utility. /// </summary> /// <param name="v">string rep of enum, or integer</param> /// <param name="res">true iff successful conversion</param> /// <returns></returns> public static bool AssayTypeConv(string v, out int res) { MeasurementOption a = MeasurementOption.rates; res = 0; bool ok = Int32.TryParse(v, out res); // is it a integer? If so, convert to the enum if (!ok) // OMFG not an integer, look for string name and convert appropriately { string lv = v.ToLower(); ok = System.Enum.TryParse <MeasurementOption>(lv, out a); res = (int)a; } return(ok); }
public bool Set(MSHTML.IHTMLTable table) { if (table == null) { return(false); } try { base.Set((object)table.bgColor, (object)table.borderColor); // have a table so extract the properties MSHTML.IHTMLTableCaption caption = table.caption; // if have a caption persist the values if (caption != null) { this.CaptionText = ((MSHTML.IHTMLElement)table.caption).innerText; if (caption.align != null) { this.CaptionAlignment = (HorizontalAlignOption)Utils.TryParseEnum(typeof(HorizontalAlignOption), caption.align, HorizontalAlignOption.Default); } if (caption.vAlign != null) { this.CaptionLocation = (VerticalAlignOption)Utils.TryParseEnum(typeof(VerticalAlignOption), caption.vAlign, VerticalAlignOption.Default); } } // look at the table properties if (table.border != null) { this.BorderSize = Utils.TryParseByte(table.border.ToString(), this.BorderSize); } if (table.align != null) { this.TableAlignment = (HorizontalAlignOption)Utils.TryParseEnum(typeof(HorizontalAlignOption), table.align, HorizontalAlignOption.Default); } // define the table rows and columns int rows = Math.Min(table.rows.length, Byte.MaxValue); int cols = Math.Min(table.cols, Byte.MaxValue); if (cols == 0 && rows > 0) { // cols value not set to get the maxiumn number of cells in the rows foreach (MSHTML.IHTMLTableRow tableRow in table.rows) { cols = Math.Max(cols, (int)tableRow.cells.length); } } this.TableRows = (byte)Math.Min(rows, byte.MaxValue); this.TableColumns = (byte)Math.Min(cols, byte.MaxValue); // define the remaining table properties if (table.cellPadding != null) { this.CellPadding = Utils.TryParseByte(table.cellPadding.ToString(), this.CellPadding); } if (table.cellSpacing != null) { this.CellSpacing = Utils.TryParseByte(table.cellSpacing.ToString(), this.CellSpacing); } if (table.width != null) { string tableWidth = table.width.ToString(); if (tableWidth.TrimEnd(null).EndsWith("%")) { this.TableWidth = Utils.TryParseUshort(tableWidth.Remove(tableWidth.LastIndexOf("%"), 1), this.TableWidth); this.TableWidthMeasurement = MeasurementOption.Percent; } else { this.TableWidth = Utils.TryParseUshort(tableWidth, this.TableWidth); this.TableWidthMeasurement = MeasurementOption.Pixel; } } else { this.TableWidth = 0; this.TableWidthMeasurement = MeasurementOption.Pixel; } } catch (Exception ex) { // throw an exception indicating table structure change be determined throw new HtmlEditorException("Unable to determine Html Table properties.", "GetTableProperties", ex); } return(true); }
/// <summary> /// anything but background and precision /// </summary> /// <param name="mo"></param> /// <returns></returns> public static bool UsesBackground(MeasurementOption mo) { return(ForMass(mo) || mo == MeasurementOption.rates || mo == MeasurementOption.initial || mo == MeasurementOption.normalization); }
public static bool DougsBasics(MeasurementOption mo) { return(mo == MeasurementOption.rates || mo == MeasurementOption.background); }
public static bool HasStratum(MeasurementOption mo) { return(mo == MeasurementOption.verification || mo == MeasurementOption.holdup); }
public static bool ForMass(MeasurementOption mo) { return(mo == MeasurementOption.verification || mo == MeasurementOption.calibration || mo == MeasurementOption.holdup); }