1

I need some help to solve an issue I'm facing using NPOI 2.3 I've created an excel with 1 jpeg picture and some shapes (just to group the fields)

In some cell I've put a value that starts with ## I need to open the excel, replace cell containing ## with correct values coming from db and save the result. All works well except when I try to reopen the modified xslx file I got an error about Drawing shape corrupted. The values are ok but all shapes and the picture are removed.

Here you can find the link TemplateFile Can someone helps me to identify the problem ? Many thanks Fab

user2332607
  • 99
  • 1
  • 3
  • 10
  • That sounds like a problem with NPOI. I suggest you look at the zipped XML in the before and after files to see what data has been incorrectly modified or discarded, and then either debug NPOI enough to find out what's going wrong and how you can fix it, or raise an issue with NPOI directly. And it might be worth trying [something else](https://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp) e.g. EPPlus as an alternative in the meantime. – Rup Jun 19 '18 at 12:25
  • NPOI is stripping most of the content out of the embedded file xl\drawings\drawing1.xml. If you open the modified xlsx as a .zip file and replace that file with a copy of the drawing1.xml from the template then that will fix it. I've no idea why NPOI is doing this though, and it might be worth you reporting this to them as a bug. – Rup Jun 19 '18 at 12:41

0 Answers0