示例#1
0
        private static void SearchByCols(ExcelFile xls, int StartRow, int EndRow, int FirstStartCol, int StartCol, int EndCol, TSearchOrReplace Action)
        {
            int RealEndRow = Math.Min(xls.RowCount, EndRow);

            for (int row = StartRow; row <= RealEndRow; row++)
            {
                int cIndex = row == StartRow?xls.ColToIndex(StartRow, FirstStartCol) : xls.ColToIndex(StartRow, StartCol);

                int ColsInRow = xls.ColCountInRow(row);
                while (cIndex <= ColsInRow)
                {
                    int XF  = -1;
                    int col = xls.ColFromIndex(row, cIndex);
                    if (col < StartCol)
                    {
                        cIndex++;
                        continue;
                    }
                    if (col > EndCol)
                    {
                        break;
                    }
                    object OldVal = xls.GetCellValueIndexed(row, cIndex, ref XF);
                    if (Action.Go(xls, OldVal, row, col))
                    {
                        return;
                    }
                    cIndex++;
                }
            }
            Action.Clear();
        }