renebigot / XlsxReaderWriter

XlsxReaderWriter is an Objective-C library for iPhone / iPad and Mac. It parses and writes MS Excel XLSX files.
MIT License
437 stars 119 forks source link

when save error #73

Open songxing10000 opened 7 years ago

songxing10000 commented 7 years ago

snip20170216_5 when I save the worksheets by code [spreadsheet save]; it can save ,but when open the xlsx file ,it say that the file broken

cristogomez commented 4 years ago

The solution is in this post: https://github.com/renebigot/XlsxReaderWriter/issues/95

"I found that this error occurs due to wrong position of XR tag in the xl/workbook.xml file. It is moved from original position. Simply move it to the previous position and the problem disappear."

The tags is: "<xr:revisionPtr", if you want to fix the excel file, move this tags from last of file to before "" tag.

And if you want to fix the Excel Library, add << @"xr:revisionPtr" >> tag in "NSDictionary+OpenXmlString.m" File. You must to add in "openXmlOrderedKeys" NSDictionary. Like this:

@"workbook": @[ @"xmlns", @"xmlns:r", @"fileVersion", @"fileSharing", @"workbookPr", @"workbookProtection", @"mc:AlternateContent", @"xr:revisionPtr", @"bookViews", @"sheets", @"functionGroups", @"externalReferences", @"definedNames", @"calcPr", @"oleSize", @"customWorkbookViews", @"pivotCaches", @"smartTagPr", @"smartTagTypes", @"webPublishing", @"fileRecoveryPr", @"webPublishObjects", @"extLst" ],