Hello,
We're using version 4.0.5 of EP Plus, which is generally working very well, so thanks for developing this excellent library. We've encountered one issue recently that we're unable to work around when removing comments. These can successfully remove comments using the following code -
workSheet.Comments.Remove(workSheet.Cells[row, col].Comment);
and then after saving the spreadsheet opens successfully in excel and the comments are gone.
However, the next time we open this and then loop through the cells we get an XmlException thrown when checking the comments on this line -
if (workSheet.Cells[row, col].Comment != null)
Currently then we have to set the comment to be an empty string, but excel views this as a comment and so the red comment marker is still appended to the cell in question.
The exception thrown is -
System.Xml.XmlException: Data at the root level is invalid. Line 41, position 7.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at OfficeOpenXml.XmlHelper.LoadXmlSafe(XmlDocument xmlDoc, Stream stream)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingBaseCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection..ctor(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
at OfficeOpenXml.ExcelWorksheet.CreateVmlCollection()
at OfficeOpenXml.ExcelWorksheet.get_Comments()
at OfficeOpenXml.ExcelRangeBase.get_Comment()
at ExcelServices.Helpers.ExcelFileHelper.RemoveCommentsAndCellFormatting(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\Helpers\ExcelFileHelper.cs:line 39
at ExcelServices.ImportFileProcessor.ValidateWorkSheet(ExcelWorksheet workSheet) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 200
at ExcelServices.ImportFileProcessor.ProcessFile(String fileName, Boolean update, Action importAction) in c:\TFS\Projects\CRM\Ada\ExcelServices\ImportFileProcessor.cs:line 155
Any help in resolving this would be much appreciated.
Comments: Same Issue here.
The File is saved by EPPlus and can't be processed again (Exception on accessing Comments)
Worksheet.Comments throws Exception caused by corrupted vmlDrawing1.vml
```
</xml>etmode="auto">
<v:fill color2="#ffffe1"/>
<v:shadow on="t" color="black" obscured="t"/>
<v:path o:connecttype="none"/>
<v:textbox style='mso-direction-alt:auto;mso-fit-shape-to-text:t'>
<div style='text-align:left'/>
</v:textbox>
<x:ClientData ObjectType="Note">
<x:MoveWithCells/>
<x:SizeWithCells/>
<x:Anchor>
7, 15, 486, 2, 10, 59, 488, 11</x:Anchor>
<x:AutoFill>False</x:AutoFill>
<x:Row>486</x:Row>
<x:Column>6</x:Column>
</x:ClientData>
</v:shape>
```
Excel can still open the file, after resave in Excel, it is working again in EPPPLus