Пример #1
0
        public void SheetdataWriter()
        {
            SXSSFWorkbook   wb = new SXSSFWorkbook();
            SXSSFSheet      sh = wb.CreateSheet() as SXSSFSheet;
            SheetDataWriter wr = sh.SheetDataWriter;

            Assert.IsTrue(wr.GetType() == typeof(SheetDataWriter));
            FileInfo tmp = wr.TempFileInfo;

            Assert.IsTrue(tmp.Name.StartsWith("poi-sxssf-sheet"));
            Assert.IsTrue(tmp.Name.EndsWith(".xml"));
            Assert.IsTrue(wb.Dispose());
            wb.Close();

            wb = new SXSSFWorkbook();
            wb.CompressTempFiles = (/*setter*/ true);
            sh = wb.CreateSheet() as SXSSFSheet;
            wr = sh.SheetDataWriter;
            Assert.IsTrue(wr.GetType() == typeof(GZIPSheetDataWriter));
            tmp = wr.TempFileInfo;
            Assert.IsTrue(tmp.Name.StartsWith("poi-sxssf-sheet-xml"));
            Assert.IsTrue(tmp.Name.EndsWith(".gz"));
            Assert.IsTrue(wb.Dispose());
            wb.Close();

            //Test escaping of Unicode control characters
            wb = new SXSSFWorkbook();
            wb.CreateSheet("S1").CreateRow(0).CreateCell(0).SetCellValue("value\u0019");
            XSSFWorkbook xssfWorkbook = SXSSFITestDataProvider.instance.WriteOutAndReadBack(wb) as XSSFWorkbook;
            ICell        cell         = xssfWorkbook.GetSheet("S1").GetRow(0).GetCell(0);

            Assert.AreEqual("value?", cell.StringCellValue);

            Assert.IsTrue(wb.Dispose());
            wb.Close();
            xssfWorkbook.Close();
        }