JanKallman / EPPlus

Create advanced Excel spreadsheets using .NET
3.76k stars 1.18k forks source link

Updating or changing the Pivot Table's source range results in a corrupted file #478

Open leveaul opened 5 years ago

leveaul commented 5 years ago

Hi, I am using EPPlus library to create functions for an OutSystems extension called "Advanced Excel". I am trying to update/change a pivot table's source range using a range or a named range but every time it results with a corrupted file at download. I tried to use a named range as a source range for my pivot table and expanding this named range. I tried to use a simple range such as "A1:D100" as a source range like that : image

But nothing worked. I always get a corrupted file.

Did I do something wrong ? Is it a bug in the library ?

KalpeshPopat commented 4 years ago

I too tried all possible options - including the ones you have listed. During my research i found that PivotTable is accepting SourceRange only if it is pointing to an ExcelTable object. so i tried to create ExcelTable object via epplus, but it seems that epplus is currently only supporting simple tables that has no formula in its columns.

In the end i have solved this problem by changing the source range of the table and providing that table as a source to pivot.