ClosedXML / ClosedXML/ClosedXML

Can't reopen and save an Excel File, Exception with message : There are multiple root elements. Line 25, position 19.'

Open
#913 2 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*?**
- [x] Bug

**Version of ClosedXML**

e.g. 0.92.0

## Reproducibility
When running the following code, we have an Exception into the method GenerateVmlDrawingPartContent. The file xl/drawings/vmlDrawing9.vml, has 2 root elements.

**Code to reproduce problem:**
```c#
public void Main()
{
string target = @"D:\temp\Export_closedXml.xlsx";
using (var wb = new XLWorkbook(@"D:\temp\closedXml\Export1.xlsx"))
{
wb.SaveAs(target);
}

using (var wb = new XLWorkbook(target))
{
wb.SaveAs(target);
}
}
```
- [x] I attached a sample spreadsheet. (You can drag files on to this issue)
[Export1.xlsx](https://github.com/ClosedXML/ClosedXML/files/2111969/Export1.xlsx)

Contributor guide

Open the contributing guide

Research direction

Start with GenerateVmlDrawingPartContent, using the attached Export1.xlsx and the provided Main method to reproduce the failure during the second save. Inspect how xl/drawings/vmlDrawing9.vml is read and written; done means the workbook can be opened, saved, reopened, and saved again without the multiple-root-elements exception.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.