public Table2Column(MigraDoc.DocumentObjectModel.Tables.Table table) : base(table) { var column = ThisTable.AddColumn("5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("13cm"); column.Format.Alignment = ParagraphAlignment.Left; }
public override void EditColumnElementByPrimaryKey(int key, object[] arguments) { try { if (ThisTable.isTableContainsData()) { if (arguments[0] == null) { throw new ArgumentException("You can't change value of FK column to null"); } if (DataType == arguments[0].GetType()) { string dataforException = default(string); if (arguments[0] == null) { dataforException = "null"; } else { dataforException = arguments[0].ToString(); } if (isLinkedColumnContainsSuchValue(arguments[0])) { if (ThisTable.returnIndexOfPrimaryKey(key) == -1) { throw new NullReferenceException("There is no such Primary Key in this table"); } DataList[ThisTable.returnIndexOfPrimaryKey(key)].Data = arguments[0]; } else { throw new ArgumentException("There is no such argument (" + dataforException + ") in linkedColumn (" + linkedColumn.Name + ")!"); } } else { throw new ArgumentException("Type of argument is not similar to Column type"); } } else { throw new NullReferenceException("Table doesn't contain any data"); } } catch (Exception e) { Console.WriteLine(e.Message); } }
// public override void EditColumnElementByIndex(int index, object[] arguments) { try { if (ThisTable.isTableContainsData()) { if (arguments[0] == null) { throw new ArgumentException("You can't change value of FK column to null"); } if (DataType == arguments[0].GetType()) { if (isLinkedColumnContainsSuchValue(arguments[0])) { if (index == -1) { throw new NullReferenceException("There is no such Primary Key in this table"); } DataList[index].Data = arguments[0]; } else { throw new ArgumentException("There is no such argument (" + arguments[0].ToString() + ") in linkedColumn (" + linkedColumn.Name + ")!"); } } else { throw new ArgumentException("Type of argument is not similar to Column type"); } } else { throw new NullReferenceException("Table doesn't contain any data"); } } catch (NullReferenceException) { } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } } //UI