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

fixed SXSSFWorkbook can not clear temp files when it called Dispose() on the IWorkbook interface. #1385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

houlongchao
Copy link

The floowing code generates 2 temp files and is not automatically cleaned. This change fixes the problem.

IWorkbook workbook = new SXSSFWorkbook();
var sheet = workbook.CreateSheet();
var row = sheet.CreateRow(0);
row.CreateCell(0).SetCellValue("test");

var sheet2 = workbook.CreateSheet();
var row2 = sheet2.CreateRow(0);
row2.CreateCell(0).SetCellValue("test");

workbook.Dispose();

@tonyqus
Copy link
Member

tonyqus commented Jul 10, 2024

You should apply using on SXSSFWorkbook. Then dispose will call Close method. It makes sense.

using(IWorkbook workbook = new SXSSFWorkbook())
{
 ...
}

@houlongchao
Copy link
Author

I Know, but the close method only close the file, cleaning temp file only seen in the dispose method.
You can test it, the temp file cannot currently be cleaned using the IWorkbook dispose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants