weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.26k stars 254 forks source link

Pivot tables broken after saving #186

Open AArmada opened 9 years ago

AArmada commented 9 years ago

If you have a workbook / worksheet that has a pivot table in it, when you reopen a file that you saved using rubyXL Excel says it found unreadable content and asks to recover. After recovery Excel states that it removed the pivot table view: Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Removed Feature: PivotTable report from /xl/pivotTables/pivotTable1.xml part (PivotTable view)

Looking at the sheet, the data in the pivot table is there, but the table itself is not.

Steps to reproduce: 1) Create a new working with a dummy data set(in Excell) 2) Create a new pivot table from this data set (in Excell) 3) Saving the file (in Excell) 4) Opening and parsing the file (parsedFile = RubyXL::Parser.parse()) 5) Saving the file (parsedFile.write())

Attempting to open the file in Excel again gives the unreadable data error. Ruby 1.9.3 Excell 2010

weshatheleopard commented 9 years ago

Can you please provide a sample file?

AArmada commented 9 years ago

http://www.filedropper.com/testexcellfile The Excel file i was using

require 'rubyXL'

parsedFile = RubyXL::Parser.parse("TestExcellFile.xlsx")
parsedFile.write("TestExcellFile2.xlsx")

This is what i was testing it with.

weshatheleopard commented 9 years ago

Thank you, I will take a look.

caedogap commented 8 years ago

Hi, I came across this same issue too, are there any updates about it? a possible workaround? Thanks.

weshatheleopard commented 8 years ago

The change required is rather massive. I don't have time to take care of that right now.

ausangshukla commented 1 year ago

+1 this will be critical to have as most use cases require data to be added, which will be used in pivot tables.