public int IsNeedNewLine(GroupDataHolder holder, int currentRowIndex, System.Data.DataTable table, int valueRowIndex) { if (iOption == InsertOption.never) { return(-1); } if (valueRowIndex == 0 && (iOption & InsertOption.onfirst) != 0) { return(0); } if (valueRowIndex == table.Rows.Count - 1 && (iOption & InsertOption.onLast) != 0) { return(0); } if ((iOption & InsertOption.afterChange) == 0 && (iOption & InsertOption.BeforeChange) == 0 && (iOption & InsertOption.always) == 0) { return(-1); } for (int i = 0; i < cellList.Count; i++) { TplCell cell = cellList[i]; if (cell.align != GroupAlign.hGroup && cell.IsNeedNewCell(holder, iOption, cell.lastColIndex, currentRowIndex, table, valueRowIndex)) { return(i); } } return(-1); }
public void CheckEachColumn(TplBlock block, GroupDataHolder holder, int currentRowIndex, System.Data.DataTable table, int valueIndex) { for (int i = 0; i < gCols; i++) { bool colInserted = false; // Check each cell in this columns for (int j = 0; j < block.lineList.Count; j++) { TplLine line = block.lineList [j]; TplCell cell = line.cellList [startCellIndex + i]; if (cell.align != GroupAlign.hGroup) { continue; } if (!colInserted) { bool needNew = cell.IsNeedNewCell(holder, cell.hgOption, 0, currentRowIndex, table, valueIndex); if (needNew) { InsertOneColumn(block, i, holder, table, valueIndex, false); colInserted = true; } } else { if ((cell.hgOption & InsertOption.BeforeChange) != 0) { continue; } // set last grouped value cell.lastGroupedValue = cell.GetGroupValue(holder, table, valueIndex); } } } }