EPPlus
EPPlus copied to clipboard
Exception: Saving file containing comments --wbPackage.Save()
I have been using EPPlus 4.5.3.2 in my project. Recently in my development setup, I updated to version 5.8.8. Now I am facing exceptions when working on xlsx files containing any comments.
Input Excel workbook contains comments for multiple cells.
var wbPackage = new ExcelPackage(new FileInfo(inputFilepath));
var wbMyOut = wbPackage.Workbook;
var wsWorkArea = GetWorkAreaWorksheet(wbMyOut); // Do some operations
if (wsWorkArea == null)
return false;
wbPackage.Save();
On last line, exception is getting thrown-
| Name | Value | Type | |
|---|---|---|---|
| Source | "EPPlus" | string | |
| StackTrace | " at OfficeOpenXml.ExcelWorksheet.SaveComments()\r\n at OfficeOpenXml.ExcelWorksheet.Save()\r\n at OfficeOpenXml.ExcelWorkbook.Save()\r\n at OfficeOpenXml.ExcelPackage.Save()" | string |
Why is this happening now? How to solve this?
@JanKallman
Can you attach a reproducible sample?
Test1.xlsx @JanKallman Attached sample file, there can be multi lingual texts in data
I'll have a look at it.
@JanKallman Help will be appreciated I tried with EPP 5.8.8, but the issue is still seen. Tried deleting if any comments were present. ws.Comments.RemoveAt(ws.Comments.Count);
Exception is hit mentioning - at OfficeOpenXml.ExcelWorksheet.SaveComments()
Are you still facing this issue? Using your test file works fine when I try it. If not, please provide sample code to reproduce this exception.
Closed due to inactivity/lack of testability.