Exemple #1
0
 /// <summary>
 /// Creates a new cells enumerator for the specified sheet area with the specified search order for the specified search range.
 /// </summary>
 /// <param name="worksheet">The sheet.</param>
 /// <param name="sheetArea">The sheet area.</param>
 /// <param name="searchOrder">The search order for this enumerator.</param>
 /// <param name="rowStart">The starting row to enumerate.</param>
 /// <param name="columnStart">The starting column to enumerate.</param>
 /// <param name="rowEnd">The ending row to enumerate.</param>
 /// <param name="columnEnd">The ending column to enumerate.</param>
 public CellsEnumerator(Worksheet worksheet, Dt.Cells.Data.SheetArea sheetArea, Dt.Cells.Data.SearchOrder searchOrder, int rowStart, int columnStart, int rowEnd, int columnEnd)
 {
     this.sheetArea       = Dt.Cells.Data.SheetArea.Cells;
     this.rowStart        = -1;
     this.rowEnd          = -1;
     this.actualEndRow    = -1;
     this.columnStart     = -1;
     this.columnEnd       = -1;
     this.actualEndColumn = -1;
     this.currentColumn   = -1;
     this.currentRow      = -1;
     this.options         = EnumeratorOption.HasStyle | EnumeratorOption.HasValue;
     if (worksheet == null)
     {
         throw new ArgumentOutOfRangeException("sheet");
     }
     this.options     = EnumeratorOption.HasStyle | EnumeratorOption.HasValue;
     this.worksheet   = worksheet;
     this.sheetArea   = sheetArea;
     this.searchOrder = searchOrder;
     this.rowStart    = rowStart;
     this.columnStart = columnStart;
     this.rowEnd      = rowEnd;
     this.columnEnd   = columnEnd;
     this.Init();
     this.block = this.worksheet.GetStorage(this.sheetArea);
 }
Exemple #2
0
        int GetNextNonEmptyColumnInRow(StorageBlock model, int row, int column)
        {
            int num = (this.SearchOrder == Dt.Cells.Data.SearchOrder.ZOrder) ? this.GetActualEndColumnZOrder(row) : this.ActualEndColumn;

            for (int i = column; i <= num; i++)
            {
                if (((model.GetValue(row, i) != null) || (model.GetTag(row, i) != null)) || (model.GetStyle(row, i) != null))
                {
                    return(i);
                }
            }
            return(-1);
        }
Exemple #3
0
        public string GetText()
        {
            if (!this.sheetValue)
            {
                return((string)(this.value as string));
            }
            if ((((this.sheet == null) || (this.row <= -1)) || ((this.row >= this.sheet.RowCount) || (this.column <= -1))) || (this.column >= this.sheet.ColumnCount))
            {
                return(string.Empty);
            }
            object obj2 = this.sheet.GetValue(this.row, this.column);

            if (obj2 == null)
            {
                return(string.Empty);
            }
            SheetArea    cells   = SheetArea.Cells;
            StorageBlock storage = this.sheet.GetStorage(cells);
            StyleInfo    info    = this.sheet.GetCompositeStyle(this.row, this.column, cells, storage);

            return(this.sheet.Value2Text(obj2, info.Formatter));
        }
Exemple #4
0
 bool NextZOrder(StorageBlock model, ref int row, ref int column)
 {
     if (model != null)
     {
         int num = this.GetNextNonEmptyColumnInRow(model, row, column + 1);
         if (num != -1)
         {
             column = num;
             if (this.IsZOrderOver(row, column))
             {
                 return(true);
             }
         }
         do
         {
             int num2 = model.NextNonEmptyRow(row);
             if ((num2 == -1) || (num2 > this.RowEnd))
             {
                 row = -1;
             }
             else
             {
                 if (num2 != -1)
                 {
                     row = num2;
                 }
                 if ((num2 != -1) && (num2 < row))
                 {
                     row = num2;
                 }
             }
             if (row != -1)
             {
                 if ((row == this.RowStart) || this.IsBlockRange)
                 {
                     column = this.ColumnStart - 1;
                 }
                 else
                 {
                     column = -1;
                 }
                 do
                 {
                     int num3 = this.GetNextNonEmptyColumnInRow(model, row, column + 1);
                     if ((num3 == -1) || ((num3 > this.ColumnEnd) && this.IsBlockRange))
                     {
                         column = -1;
                     }
                     else
                     {
                         if (num3 != -1)
                         {
                             column = num3;
                         }
                         if ((num3 != -1) && (num3 < column))
                         {
                             column = num3;
                         }
                     }
                     if (column != -1)
                     {
                         return(this.IsZOrderOver(row, column));
                     }
                 }while (column != -1);
             }
         }while (row != -1);
     }
     return(false);
 }