EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Exception: Saving file containing comments --wbPackage.Save()

Open HyderAli1990 opened this issue 3 years ago • 6 comments

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?

HyderAli1990 avatar May 04 '22 13:05 HyderAli1990

@JanKallman

HyderAli1990 avatar May 05 '22 04:05 HyderAli1990

Can you attach a reproducible sample?

JanKallman avatar May 05 '22 07:05 JanKallman

Test1.xlsx @JanKallman Attached sample file, there can be multi lingual texts in data

HyderAli1990 avatar May 11 '22 13:05 HyderAli1990

I'll have a look at it.

JanKallman avatar May 13 '22 12:05 JanKallman

@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()

HyderAli1990 avatar Jun 08 '22 12:06 HyderAli1990

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.

JanKallman avatar Aug 31 '22 07:08 JanKallman

Closed due to inactivity/lack of testability.

OssianEPPlus avatar Feb 08 '24 10:02 OssianEPPlus