iTextSharp.text.Table.PlaceCell C# (CSharp) Method

PlaceCell() private method

Inserts a Cell in a cell-array and reserves cells defined by row-/colspan.
private PlaceCell ( ArrayList someRows, Cell aCell, System aPosition ) : void
someRows System.Collections.ArrayList some rows
aCell Cell the cell that has to be inserted
aPosition System the position where the cell has to be placed
return void
        private void PlaceCell(ArrayList someRows, Cell aCell, System.Drawing.Point aPosition) {
            int i;
            Row row = null;
            int rowCount = aPosition.X + aCell.Rowspan - someRows.Count;
            AssumeTableDefaults(aCell);
            if ( (aPosition.X + aCell.Rowspan) > someRows.Count ) {        //create new rows ?
                for (i = 0; i < rowCount; i++) {
                    row = new Row(columns);
                    someRows.Add(row);
                }
            }

            // reserve cell in rows below
            for (i = aPosition.X + 1; i < (aPosition.X  + aCell.Rowspan); i++) {
                if ( !((Row) someRows[i]).Reserve(aPosition.Y, aCell.Colspan)) {

                    // should be impossible to come here :-)
                    throw new Exception("addCell - error in reserve");
                }
            }
            row = (Row) someRows[aPosition.X];
            row.AddElement(aCell, aPosition.Y);

        }