Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Pivot table corrupts the document [15295]

$
0
0
I attach input.xlsx. When I open this file with EPPlus, and save it, this results in output.xlsx, which is also attached. When I open output.xlsx in Excel, it gives me error saying the file is corrupt. After repairing the file, Excel lists the following issues:
- Removed Part: /xl/pivotTables/pivotTable1.xml part. (PivotTable view)
- Removed Feature: PivotTable report from /xl/pivotCache/pivotCacheDefinition1.xml part (PivotTable cache)
- Removed Records: Workbook properties from /xl/workbook.xml part (Workbook)

I also attach the source code which allows to replicate this issue.

[update]
I have managed to nail the issue. The problem occurs when there exist two columns of same descriptions in the data which the pivot table is based on. In this situation EPPlus generates two equally named nodes in this file:
xl\pivotCache\pivotCacheDefinition1.xml

The corrupted XML looks like this:
<cacheField name="Region" ... >
...
<cacheField name="Region" ... >

The valid XML should look like this:
<cacheField name="Region" ... >
...
<cacheField name="Region2" ... >

The workaround is to keep the column descriptions unique in the Excel document.
I attach the "input_fixed.xlsx" file, in which the issue does not occur.
Comments: Fixed in changeset 65115680ca04

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>