예제 #1
0
        /**
         * Construct a XSSFRow.
         *
         * @param row the xml bean Containing all cell defInitions for this row.
         * @param sheet the parent sheet.
         */
        public XSSFRow(CT_Row row, XSSFSheet sheet)
        {
            this._row   = row;
            this._sheet = sheet;
            this._cells = new SortedDictionary <int, ICell>();
            if (0 < row.SizeOfCArray())
            {
                foreach (CT_Cell c in row.c)
                {
                    XSSFCell cell = new XSSFCell(this, c);
                    _cells.Add(cell.ColumnIndex, cell);
                    sheet.OnReadCell(cell);
                }
            }

            if (!row.IsSetR())
            {
                // Certain file format writers skip the row number
                // Assume no gaps, and give this the next row number
                int nextRowNum = sheet.LastRowNum + 2;
                if (nextRowNum == 2 && sheet.PhysicalNumberOfRows == 0)
                {
                    nextRowNum = 1;
                }
                row.r = (uint)nextRowNum;
            }
        }
예제 #2
0
파일: XSSFRow.cs 프로젝트: yesonsik/npoi
 /**
  * Construct a XSSFRow.
  *
  * @param row the xml bean Containing all cell defInitions for this row.
  * @param sheet the parent sheet.
  */
 public XSSFRow(CT_Row row, XSSFSheet sheet)
 {
     _row   = row;
     _sheet = sheet;
     _cells = new SortedDictionary <int, ICell>();
     if (0 < row.SizeOfCArray())
     {
         foreach (CT_Cell c in row.c)
         {
             XSSFCell cell = new XSSFCell(this, c);
             _cells.Add(cell.ColumnIndex, cell);
             sheet.OnReadCell(cell);
         }
     }
 }
예제 #3
0
 public XSSFRow(CT_Row row, XSSFSheet sheet)
 {
     this._row   = row;
     this._sheet = sheet;
     this._cells = new SortedDictionary <int, ICell>();
     if (0 >= row.SizeOfCArray())
     {
         return;
     }
     foreach (CT_Cell cell1 in row.c)
     {
         XSSFCell cell2 = new XSSFCell(this, cell1);
         this._cells.Add(cell2.ColumnIndex, (ICell)cell2);
         sheet.OnReadCell(cell2);
     }
 }
예제 #4
0
파일: XSSFRow.cs 프로젝트: yesonsik/npoi
        /**
         * Fired when the document is written to an output stream.
         *
         * @see NPOI.XSSF.usermodel.XSSFSheet#Write(java.io.OutputStream) ()
         */
        internal void OnDocumentWrite()
        {
            // check if cells in the CT_Row are ordered
            bool isOrdered = true;

            if (_row.SizeOfCArray() != _cells.Count)
            {
                isOrdered = false;
            }
            else
            {
                int i = 0;
                foreach (XSSFCell cell in _cells.Values)
                {
                    CT_Cell c1 = cell.GetCTCell();
                    CT_Cell c2 = _row.GetCArray(i++);

                    String r1 = c1.r;
                    String r2 = c2.r;
                    if (!(r1 == null ? r2 == null : r1.Equals(r2)))
                    {
                        isOrdered = false;
                        break;
                    }
                }
            }

            if (!isOrdered)
            {
                CT_Cell[] cArray = new CT_Cell[_cells.Count];
                int       i      = 0;
                foreach (XSSFCell c in _cells.Values)
                {
                    cArray[i++] = c.GetCTCell();
                }
                _row.SetCArray(cArray);
            }
        }