/// <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; } }
// 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; } }
public bool Set(MSHTML.IHTMLTableCell cell) { // if user has selected a table extract those properties if (cell == null) { return(false); } try { base.Set((object)cell.bgColor, (object)cell.borderColor); if (cell.align != null) { this.HorzAlignment = (HorizontalAlignOption)Utils.TryParseEnum(typeof(HorizontalAlignOption), cell.align, HorizontalAlignOption.Default); } if (cell.vAlign != null) { this.VertAlignment = (VerticalAlignOption)Utils.TryParseEnum(typeof(VerticalAlignOption), cell.vAlign, VerticalAlignOption.Default); } this.ColSpan = cell.colSpan; this.RowSpan = cell.rowSpan; this.NoWrap = cell.noWrap; } catch (Exception ex) { // throw an exception indicating table structure change be determined throw new HtmlEditorException("Unable to determine Html Cell properties.", "GetCellProperties", ex); } return(true); }
public bool Set(MSHTML.IHTMLTableRow row) { // if user has selected a table extract those properties if (row == null) { return(false); } try { base.Set((object)row.bgColor, (object)row.borderColor); if (row.align != null) { this.HorzAlignment = (HorizontalAlignOption)Utils.TryParseEnum(typeof(HorizontalAlignOption), row.align, HorizontalAlignOption.Default); } if (row.vAlign != null) { this.VertAlignment = (VerticalAlignOption)Utils.TryParseEnum(typeof(VerticalAlignOption), row.vAlign, VerticalAlignOption.Default); } if (row.bgColor != null) { this.BackColor = ColorTranslator.FromHtml(row.bgColor.ToString()); } } catch (Exception ex) { // throw an exception indicating table structure change be determined throw new HtmlEditorException("Unable to determine Html Row properties.", "GetRowProperties", ex); } return(true); }
/// <summary> /// Constructor defining a base cell with default attributes /// </summary> public HtmlTableCellProperty() : base() { HorzAlignment = HorizontalAlignOption.Default; VertAlignment = VerticalAlignOption.Default; ColSpan = 1; RowSpan = 1; NoWrap = false; }
public static HorizontalAlignOption GetEnumByString(string pNume) { HorizontalAlignOption lId = HorizontalAlignOption.Nedefinit; foreach (StructHorizontalAlignOption xStruct in GetList()) { if (xStruct.Nume.Equals(pNume.Trim())) { lId = xStruct.Id; break; } } return(lId); }
public static StructHorizontalAlignOption GetStructByEnum(HorizontalAlignOption pId) { switch (pId) { case HorizontalAlignOption.Default: return(new StructHorizontalAlignOption(HorizontalAlignOption.Default, IHMUtile.getText(1200))); case HorizontalAlignOption.Left: return(new StructHorizontalAlignOption(HorizontalAlignOption.Left, IHMUtile.getText(1203))); //"Stânga"); case HorizontalAlignOption.Center: return(new StructHorizontalAlignOption(HorizontalAlignOption.Center, IHMUtile.getText(1204))); //"Centru"); case HorizontalAlignOption.Right: return(new StructHorizontalAlignOption(HorizontalAlignOption.Right, IHMUtile.getText(1205))); //"Dreapta"); } return(new StructHorizontalAlignOption(HorizontalAlignOption.Nedefinit, "")); }
public StructHorizontalAlignOption(HorizontalAlignOption pId, string pNume) : this() { this.Id = pId; this.Nume = pNume; }
public static string GetStringByEnum(HorizontalAlignOption pId) { return(GetStructByEnum(pId).Nume); }
/// <summary> /// Constructor defining a base row with default attributes /// </summary> public HtmlTableRowProperty() : base() { HorzAlignment = HorizontalAlignOption.Default; VertAlignment = VerticalAlignOption.Default; }
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); }