This project has moved and is read-only. For the latest updates, please go here.
1
Vote

Excel corrupts after open and save a xlsx document with a pivot table

description

When I open an existing .xlsx document with a pivot table and then save it, it courrupts.

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)

Here is the code. As you can see is just open and save it.
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.IO
Imports OfficeOpenXml
Imports System.Data.SqlClient
Imports OfficeOpenXml.Table.PivotTable
Imports System.Xml


Module Module1

    Sub Main()

        Try
            Dim path As String = "C:\example.xlsx"

            Dim package As ExcelPackage = New ExcelPackage(New FileInfo(path))



            package.Save()
            package.Dispose()


        Catch ex As Exception


            Console.WriteLine(ex.Message)
            Console.Read()

        End Try

    End Sub


End Module
Even without doing a change to the document this happens to me.

file attachments

comments

ricardok1 wrote Apr 5 at 9:01 PM

Hi there
I have the same problem - any update on this? there's any workaround?
Thanks
Ricardo