/// <summary> /// Adds a Cell to the Table at a certain location. /// </summary> /// <param name="aCell">The Cell to add</param> /// <param name="aLocation">The location where the Cell will be added</param> public void AddCell(Cell aCell, object aLocation) { System.Drawing.Point p; if (aCell == null) throw new Exception("addCell - cell has null-value"); if (aLocation == null) throw new Exception("addCell - point has null-value"); else p = (System.Drawing.Point)aLocation; if (aCell.IsTable()) { IEnumerator i = aCell.Elements.GetEnumerator(); i.MoveNext(); InsertTable((Table)i.Current, p); } if (p.X < 0) throw new BadElementException("row coordinate of location must be >= 0"); if ((p.Y <= 0) && (p.Y > columns)) throw new BadElementException("column coordinate of location must be >= 0 and < nr of columns"); if (!IsValidLocation(aCell, p)) throw new BadElementException("Adding a cell at the location (" + p.X + "," + p.Y + ") with a colspan of " + aCell.Colspan + " and a rowspan of " + aCell.Rowspan + " is illegal (beyond boundaries/overlapping)."); if (aCell.Border == UNDEFINED) aCell.Border = defaultCell.Border; aCell.Fill(); PlaceCell(rows, aCell, p); CurrentLocationToNextValidPosition = p; }