nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.65k stars 1.42k forks source link

Broken xlsx file created by SXSSFWorkbook - Open with Excel 2007 #1363

Closed 6933 closed 2 months ago

6933 commented 2 months ago

NPOI Version 2.6.2 / 2.7.0

File Type

Upload the Excel File

result2.xlsx

Please attach your original Excel File to help us reproduce the issue

Reproduce Steps

Issue Description

Net8 / net6 下


            SXSSFWorkbook wb = new SXSSFWorkbook(); // keep 100 rows in memory, exceeding rows will be flushed to disk
            ISheet sh = wb.CreateSheet();
            for (int rownum = 0; rownum < 1000; rownum++)
            {
                IRow row = sh.CreateRow(rownum);
                for (int cellnum = 0; cellnum < 10; cellnum++)
                {
                    ICell cell = row.CreateCell(cellnum);
                    String address = new CellReference(cell).FormatAsString();
                    cell.SetCellValue(address);
                }
            }
            var filepath = Path.Combine("D:\\test", "result2.xlsx");
            using (var fs = File.Create(filepath))
            {
                wb.Write(fs);
            }

生成的文件,在excel2007打开时,报错: Excel在 result2.xlsx 中发现不可读取的内容。是否恢复此工作簿的内容?

tonyqus commented 2 months ago

The result2.xlsx can be opened correctly in Excel 2016. Can you test with Excel 2016 instead of Excel 2007?

6933 commented 2 months ago

我在office2010、WPS2024、 LibreOffice7.3.7.2测试了,都可以正常打开。

------------------ 原始邮件 ------------------ 发件人: "nissl-lab/npoi" @.>; 发送时间: 2024年6月6日(星期四) 下午5:53 @.>; @.**@.>; 主题: Re: [nissl-lab/npoi] broken xlsx file created by SXSSFWorkbook (Issue #1363)

The result2.xlsx can be opened correctly in Excel 2016. Can you test with Excel 2016 instead of Excel 2007?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

tonyqus commented 2 months ago

I don't have Excel 2007. This issue will be closed.