示例#1
0
        public ExcelRow GetRow(UInt32 rowIndex)
        {
            if (rowIndex < 1)
            {
                throw new ArgumentException("Index row can not be less than 1!");
            }
            if (this.List.ContainsKey(rowIndex))
            {
                return(this.List[rowIndex]);
            }

            Row newRow = new Row()
            {
                RowIndex = rowIndex
            };
            ExcelRow nextRow = this.List.FirstOrDefault(p => p.Key > rowIndex).Value;

            if (nextRow != null)
            {
                sheet.worksheet.GetFirstChild <SheetData>().InsertBefore(newRow, nextRow.row);
            }
            else
            {
                sheet.worksheet.GetFirstChild <SheetData>().Append(newRow);
            }

            ExcelRow retVal = new ExcelRow(newRow, sheet);

            this.List.Add(rowIndex, retVal);

            return(retVal);
        }
示例#2
0
 public ExcelCellCollection(ExcelRow row)
 {
     this.row  = row;
     this.List = new SortedDictionary <uint, ExcelCell>();
     foreach (Cell cell in row.row.Elements <Cell>())
     {
         ExcelCell newCell = new ExcelCell(cell, row);
         this.List.Add(newCell.Index, newCell);
     }
 }
示例#3
0
        public ExcelRow GetRow(UInt32 rowIndex)
        {
            if (rowIndex < 1) throw new ArgumentException("Index row can not be less than 1!");
            if (this.List.ContainsKey(rowIndex))
                return this.List[rowIndex];

            Row newRow = new Row() { RowIndex = rowIndex };
            ExcelRow nextRow = this.List.FirstOrDefault(p => p.Key > rowIndex).Value;
            if(nextRow != null)
                sheet.worksheet.GetFirstChild<SheetData>().InsertBefore(newRow, nextRow.row);
            else
                sheet.worksheet.GetFirstChild<SheetData>().Append(newRow);

            ExcelRow retVal = new ExcelRow(newRow, sheet);
            this.List.Add(rowIndex, retVal);

            return retVal;
        }
示例#4
0
 public ExcelCellCollection(ExcelRow row)
 {
     this.row = row;
     this.List = new SortedDictionary<uint, ExcelCell>();
     foreach (Cell cell in row.row.Elements<Cell>())
     {
         ExcelCell newCell = new ExcelCell(cell, row);
         this.List.Add(newCell.Index, newCell);
     }
 }
示例#5
0
 public ExcelCell(Cell cell, ExcelRow row)
 {
     this.row = row;
     this.cell = cell;
 }
示例#6
0
 public ExcelCell(Cell cell, ExcelRow row)
 {
     this.row  = row;
     this.cell = cell;
 }