ClosedXML / ClosedXML/ClosedXML

file corruption with deleting rows there are containing picture

Open
#2,190 0 comments 0 reactions 0 assignees View on GitHub
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*?**
- [] Bug
- [ ] Feature
- [x] Question

**Did you test against the latest CI build?**
- [x] Yes
- [ ] No

**Version of ClosedXML**
e.g. 0.103.0 -beta

**What is the current behavior?**
file gets corrupted.

**What is the expected behavior or new feature?**
The included images are deleted in conjunction with row deletion. Files are not corrupted.

**Is this a regression from the previous version?**
I haven't used previous versions

## Reproducibility
The code below causes a problem.
Is it a bug? Or is there something wrong with my coding?

**Code to reproduce problem:**
```c#
public void Main()
{
ClosedXML.Excel.XLWorkbook workbook = new
ClosedXML.Excel.XLWorkbook("withpicture.xlsx");
ClosedXML.Excel.IXLWorksheet s1 = workbook.Worksheet("sheet1");
s1.RowsUsed(ClosedXML.Excel.XLCellsUsedOptions.All).Delete();
workbook.Save();
workbook.Dispose();
}
```
[withpicture.xlsx](https://github.com/ClosedXML/ClosedXML/files/12854567/withpicture.xlsx)

- [*] I attached a sample spreadsheet. (You can drag files on to this issue)

Contributor guide

Open the contributing guide

Research direction

Start with the attached withpicture.xlsx and reproduce the issue using XLWorkbook, Worksheet("sheet1"), RowsUsed(XLCellsUsedOptions.All).Delete(), and workbook.Save(). Inspect the saved workbook after deleting the used rows. Done means the rows are deleted, the included images are removed as expected, and the resulting spreadsheet is not corrupted.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.