ClosedXML / ClosedXML/ClosedXML
How can I close the file after saved with ClosedXML?
- Dominant language
- C#
- Stars
- 5.7k
- Forks
- 933
- Avg merge
- 12h 14m
- Merged PRs (30d)
- 1
Description
**Do you want to request a *feature* or report a *bug*?**
- [x] Bug
- [ ] Feature
- [ ] Question
**Did you test against the latest CI build?**
- [ ] Yes
- [ ] No
If you answered `No`, please test with [the latest development build](https://ci.appveyor.com/project/ClosedXML/ClosedXML/branch/develop/artifacts) first.
**Version of ClosedXML**
0.95.4
**What is the current behavior?**
System.NullReferenceException issue when wb.SaveAs(filename) more then one time.
**Code to reproduce problem:**
```c#
public void Main()
{
// process data in data_1 and data_2
// excel template preset 2 worksheet
string file_template = @\"template_excle.xlsx";
var xlsx = function_Export(data_1, sheet_1, file_template);
string filepath = export_fullpath + "result.xlsx";
xlsx.SaveAs(filepath);
xlsx = function_Export(data_2, sheet_2, filepath);
xlsx.SaveAs(filepath);
}
```
- [ ] I attached a sample spreadsheet. (You can drag files on to this issue)
Contributor guide
Research direction
Start by reproducing the reported sequence against ClosedXML 0.95.4, including two SaveAs calls using the provided code. Capture the NullReferenceException stack trace and compare behavior when saving the same workbook to the existing path; done when the cause and expected file-closing behavior are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100