/// <summary> /// 添加一个单元格 /// </summary> /// <param name="columnIndex"></param> /// <param name="rowIndex"></param> /// <param name="content"></param> public CellData AddCell(int columnIndex, int rowIndex, string content, float rowHeigth, float columnWidth, int rowMerge, int columnMerge, bool isNull) { var cell = TableController.CellController.Create <TableCell>(); var data = CellDatas.FirstOrDefault(p => p.ColumnIndex == columnIndex && p.RowIndex == rowIndex); if (data != null) { data.Content = content; return(data); } data = new CellData(TableController, cell, columnIndex, rowIndex, content, rowHeigth, columnWidth, rowMerge, columnMerge, isNull); if (columnIndex < ColumnDatas.Count) { var column = ColumnDatas[columnIndex]; data.ColumnWidth = column.Width; } if (rowIndex < RowDatas.Count) { var row = RowDatas[rowIndex]; data.RowHeigth = row.Heigth; } CellDatas.Add(data); return(data); }
public CellData this[int index] { get { return(CellDatas.FirstOrDefault(p => p.ColumnIndex == index)); } set { for (int i = 0; i < CellDatas.Count; i++) { if (CellDatas[i].ColumnIndex == index) { CellDatas[i] = value; return; } } } }
public CellData this[int columnIndex, int rowIndex] { get { return(CellDatas.FirstOrDefault(p => p.ColumnIndex == columnIndex && p.RowIndex == rowIndex)); } }