public void SetFontInRow(int index, Font font) { List <AbstractCell> list = this.tableData[index]; foreach (object current in list) { if (current is Cell) { Cell cell = (Cell)current; cell.SetFont(font); } } }
public void SetFontInColumn(int index, Font font) { foreach (List <AbstractCell> current in this.tableData) { if (index < current.Count) { object obj = current[index]; if (obj is Cell) { Cell cell = (Cell)obj; cell.SetFont(font); } } } }
public List<List<Cell>> GetData( String fileName, String delimiter, int numOfHeaderRows, Font f1, Font f2) { List<List<Cell>> tableData = new List<List<Cell>>(); int currentRow = 0; StreamReader reader = new StreamReader(fileName); String line = null; while ((line = reader.ReadLine()) != null) { List<Cell> row = new List<Cell>(); String[] cols = null; if (delimiter.Equals("|")) { cols = line.Split(new Char[] {'|'}); } else if (delimiter.Equals("\t")) { cols = line.Split(new Char[] {'\t'}); } else { throw new Exception( "Only pipes and tabs can be used as delimiters"); } for (int i = 0; i < cols.Length; i++) { Cell cell = new Cell(f2, cols[i].Trim()); if (currentRow < numOfHeaderRows) { cell.SetFont(f1); } row.Add(cell); } tableData.Add(row); currentRow++; } reader.Close(); appendMissingCells(tableData, f2); return tableData; }