Exemple #1
0
        public void TestLastAndFirstColumns_bug46654()
        {
            int          ROW_IX   = 10;
            int          COL_IX   = 3;
            HSSFWorkbook workbook = new HSSFWorkbook();
            HSSFSheet    sheet    = (HSSFSheet)workbook.CreateSheet("Sheet1");
            RowRecord    rowRec   = new RowRecord(ROW_IX);

            rowRec.FirstCol = ((short)2);
            rowRec.LastCol  = ((short)5);

            BlankRecord br = new BlankRecord();

            br.Row    = (ROW_IX);
            br.Column = ((short)COL_IX);

            sheet.Sheet.AddValueRecord(ROW_IX, br);
            HSSFRow row  = new HSSFRow(workbook, sheet, rowRec);
            ICell   cell = row.CreateCellFromRecord(br);

            if (row.FirstCellNum == 2 && row.LastCellNum == 5)
            {
                throw new AssertionException("Identified bug 46654a");
            }
            Assert.AreEqual(COL_IX, row.FirstCellNum);
            Assert.AreEqual(COL_IX + 1, row.LastCellNum);
            row.RemoveCell(cell);
            Assert.AreEqual(-1, row.FirstCellNum);
            Assert.AreEqual(-1, row.LastCellNum);
        }