Ejemplo n.º 1
0
        public void TestNotCreateEmptyCells()
        {
            IWorkbook wb = new HSSFWorkbook();

            Npoi.Core.SS.UserModel.ISheet sheet = new SheetBuilder(wb, testData).Build();

            Assert.AreEqual(sheet.PhysicalNumberOfRows, 3);

            Npoi.Core.SS.UserModel.IRow  firstRow  = sheet.GetRow(0);
            Npoi.Core.SS.UserModel.ICell firstCell = firstRow.GetCell(0);

            Assert.AreEqual(firstCell.CellType, CellType.Numeric);
            Assert.AreEqual(1.0, firstCell.NumericCellValue, 0.00001);


            Npoi.Core.SS.UserModel.IRow secondRow = sheet.GetRow(1);
            Assert.IsNotNull(secondRow.GetCell(0));
            Assert.IsNull(secondRow.GetCell(2));

            Npoi.Core.SS.UserModel.IRow thirdRow = sheet.GetRow(2);
            Assert.AreEqual(CellType.String, thirdRow.GetCell(0).CellType);
            string cellValue = thirdRow.GetCell(0).StringCellValue;

            Assert.AreEqual(testData[2][0].ToString(), cellValue);

            Assert.AreEqual(CellType.Formula, thirdRow.GetCell(2).CellType);
            Assert.AreEqual("A1+B2", thirdRow.GetCell(2).CellFormula);
        }
Ejemplo n.º 2
0
 public override bool Equals(object obj)
 {
     Npoi.Core.SS.UserModel.ICell cellb = ((HSSFEvaluationCell)obj)._cell;
     return(_cell.RowIndex == cellb.RowIndex &&
            _cell.ColumnIndex == cellb.ColumnIndex &&
            _cell.CellFormula == cellb.CellFormula &&
            _cell.Sheet == cellb.Sheet);
 }
Ejemplo n.º 3
0
        public void TestEmptyCells()
        {
            Npoi.Core.SS.UserModel.IWorkbook wb    = new HSSFWorkbook();
            Npoi.Core.SS.UserModel.ISheet    sheet = new SheetBuilder(wb, testData).SetCreateEmptyCells(true).Build();

            Npoi.Core.SS.UserModel.ICell emptyCell = sheet.GetRow(1).GetCell(1);
            Assert.IsNotNull(emptyCell);
            Assert.AreEqual(CellType.Blank, emptyCell.CellType);
        }
Ejemplo n.º 4
0
 public HSSFEvaluationCell(Npoi.Core.SS.UserModel.ICell cell)
 {
     _cell      = cell;
     _evalSheet = new HSSFEvaluationSheet((HSSFSheet)cell.Sheet);
 }
Ejemplo n.º 5
0
 public HSSFEvaluationCell(Npoi.Core.SS.UserModel.ICell cell, IEvaluationSheet evalSheet)
 {
     _cell      = cell;
     _evalSheet = evalSheet;
 }