EPPlus
EPPlus copied to clipboard
SetValue sets "" to cells containing multiple text colours
Calling SetValue on cells that have a text containing mutiple colours for example this. Are replaced by "" instead of the value provided to SetValue This simple script:
ExcelPackage p = new ExcelPackage(new FileInfo("sheet.xlsx"));
p.Workbook.Worksheets[1].SetValue("A1", "Text to replace");
p.Workbook.Worksheets[1].SetValue("A2", "B Color");
p.Save();
will set all of the text fields above to "" (by looking at the debugger)
Using: EPPlus 4.5.1.0
I can provide more info if necessary.
I have the same issue in the 4.5.3.2 version. The cell value is always an empty string after modification. @EPPlus any thoughts?
To avoid the issue you need to call the below method before setting any new value.
p.Workbook.Worksheets[1].Cells[1,1].Clear()
Of course it will erase all text colors, however it works and not so critical for me.