Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks
6933 opened this issue Jun 5, 2024 · 3 comments
Closed
4 tasks

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

6933 opened this issue Jun 5, 2024 · 3 comments
Labels
file_error file format generation/writing issue invalid

Comments

@6933
Copy link

6933 commented Jun 5, 2024

NPOI Version 2.6.2 / 2.7.0

File Type

  • [ x] XLSX
  • XLS
  • DOCX
  • XLSM
  • OTHER

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 中发现不可读取的内容。是否恢复此工作簿的内容?

@6933 6933 added the bug label Jun 5, 2024
@tonyqus tonyqus changed the title net core中生成的xlsx文件已损坏 broken xlsx file created by SXSSFWorkbook Jun 6, 2024
@tonyqus
Copy link
Member

tonyqus commented Jun 6, 2024

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

@tonyqus tonyqus added the file_error file format generation/writing issue label Jun 6, 2024
@tonyqus tonyqus changed the title broken xlsx file created by SXSSFWorkbook Broken xlsx file created by SXSSFWorkbook - Open with Excel 2007 Jun 6, 2024
@6933
Copy link
Author

6933 commented Jun 7, 2024 via email

@tonyqus
Copy link
Member

tonyqus commented Jun 7, 2024

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

@tonyqus tonyqus closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file_error file format generation/writing issue invalid
Projects
None yet
Development

No branches or pull requests

2 participants