Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair warnings from Excel #1

Closed
timblinq opened this issue Dec 5, 2011 · 3 comments
Closed

Repair warnings from Excel #1

timblinq opened this issue Dec 5, 2011 · 3 comments
Assignees

Comments

@timblinq
Copy link

timblinq commented Dec 5, 2011

When creating a spreadsheet with this gem, I get a repair warning from Excel for Mac 2011, Version 14.1.3 (110805),
the same that you get when you have a corrupted xlsx document. Here is the repair log from Excel:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">

  <logFileName>Repair Result to example1 00854.xml</logFileName>
  <summary>Errors were detected in file 'Macintosh
  HD:Users:tim:src:axlsx:example1.xlsx'</summary>
  <additionalInfo>
    <info>Excel completed file level validation and repair. Some
    parts of this workbook may have been repaired or
    discarded.</info>
  </additionalInfo>
  <repairedRecords summary="Following is a list of repairs:">
    <repairedRecord>Repaired Records: Cell information from
    /xl/worksheets/sheet1.xml</repairedRecord>
  </repairedRecords>
</recoveryLog>

The repaired document appears to have all the correct data, though.

Here is a diff of the two sheet1.xml files pre and post repair follows:

1,2c1,15
< <?xml version="1.0" encoding="UTF-8"?>
< <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">

---
> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
> <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
> xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
> mc:Ignorable="x14ac"
> xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
> 
>   <dimension ref="A1:C2" />
>   <sheetViews>
>     <sheetView tabSelected="1" workbookViewId="0">
>       <selection activeCell="D7" sqref="D7" />
>     </sheetView>
>   </sheetViews>
>   <sheetFormatPr baseColWidth="10" defaultRowHeight="15"
>   x14ac:dyDescent="0" />
4,6c17,19
<     <col min="1" max="1" width="4.25" customWidth="true"/>
<     <col min="2" max="2" width="10.25" customWidth="true"/>
<     <col min="3" max="3" width="25.25" customWidth="true"/>

---
>     <col min="1" max="1" width="4.28515625" customWidth="1" />
>     <col min="2" max="2" width="10.28515625" customWidth="1" />
>     <col min="3" max="3" width="25.28515625" customWidth="1" />
9,32c22,30
<     <row r="1">
<       <c r="A1" s="0">
<         <is>
<           <r>
<             <rPr/>
<             <t>First</t>
<           </r>
<         </is>
<       </c>
<       <c r="B1" s="0">
<         <is>
<           <r>
<             <rPr/>
<             <t>Second</t>
<           </r>
<         </is>
<       </c>
<       <c r="C1" s="0">
<         <is>
<           <r>
<             <rPr/>
<             <t>Third</t>
<           </r>
<         </is>

---
>     <row r="1" spans="1:3" ht="13">
>       <c r="A1" t="s">
>         <v>0</v>
>       </c>
>       <c r="B1" t="s">
>         <v>1</v>
>       </c>
>       <c r="C1" t="s">
>         <v>2</v>
35,36c33,34
<     <row r="2">
<       <c r="A2" s="0">

---
>     <row r="2" spans="1:3" ht="13">
>       <c r="A2">
39c37
<       <c r="B2" s="0">

---
>       <c r="B2">
42,43c40,41
<       <c r="C2" s="2">
<         <v>40881.18424629247</v>

---
>       <c r="C2" s="1">
>         <v>40881.184246292469</v>
46a45,53
>   <pageMargins left="0.75" right="0.75" top="1" bottom="1"
>   header="0.5" footer="0.5" />
>   <extLst>
>     <ext uri="{64002731-A6B0-56B0-2670-7721B7C09600}"
>     xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main">
> 
>       <mx:PLV Mode="0" OnePage="0" WScale="0" />
>     </ext>
>   </extLst>

Files example1/xl/workbook.xml and example1-repaired/xl/workbook.xml differ significantly:

1,6c1,23
< <?xml version="1.0" encoding="UTF-8"?>
< <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
< <workbookPr date1904="false"/>
< <sheets>
< <sheet name="Sheet1" sheetId="1" r:id="rId1"/>
< </sheets>

---
> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
> <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
> xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
> 
>   <fileVersion appName="xl" lastEdited="5" lowestEdited="5"
>   rupBuild="21405" />
>   <workbookPr autoCompressPictures="0" />
>   <bookViews>
>     <workbookView xWindow="0" yWindow="440" windowWidth="25600"
>     windowHeight="15620" tabRatio="500" />
>   </bookViews>
>   <sheets>
>     <sheet name="Sheet1" sheetId="1" r:id="rId1" />
>   </sheets>
>   <calcPr calcId="0" concurrentCalc="0" />
>   <fileRecoveryPr repairLoad="1" />
>   <extLst>
>     <ext uri="{7523E5D3-25F3-A5E0-1632-64F254C22452}"
>     xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main">
> 
>       <mx:ArchID Flags="2" />
>     </ext>
>   </extLst>

Additionally, Excel adds a few files:

Only in example1-repaired/docProps: core0.xml
Only in example1-repaired/xl: sharedStrings.xml
Only in example1-repaired/xl: theme

Any ideas on what's up and how we can get rid of the warning?

I'm on OS X Lion, with the default libxml (not libxml2 via homebrew) and in a gemset using the gems outlined in the axlsx gem's Gemfile. I also am using ruby-1.9.3-p0 but encountered the same issues under ree-1.8.7-2011.03

Here are the files I tested:

@ghost ghost assigned randym Dec 6, 2011
@randym
Copy link
Owner

randym commented Dec 6, 2011

Hi Tim,

Thanks for your excellent report.

Excel will add a considerable amount of excel specific information when you open an Office Open XML spreadsheet as well as move all of your string data into a shared string xml, so the extra files, etc are normal. However having the cell data repaired is not.

Looking at the error message "Repaired Records: Cell information from /xl/worksheets/sheet1.xml" my first hunch is that the value used to represent the date in cell C2 or the column width specifications need to rounded, or Excel 2011 requires the mc and x14ac namespaces. I've pushed a patch do the rounding and add the namespaces sans the 'Ignorable' attribute as it is not part of the ECMA standard and will break validation.

However, I wont be able to confirm if this fixes the warning until I get 2011 installed on my mac.

@randym
Copy link
Owner

randym commented Dec 7, 2011

Hi Tim,

Turns out it is a problem with the zip library I was using to get Unicode support. Switching the gem dependency back to rubyzip resolves repair warning but unfortunately breaks support for Japanese/Chinese/Korean text in the workbook.

Ill be contacting the maintainers of rubyzip to see if they can help out.
If you are in a hurry, and you are only going to be using English text, let me know and I will build a non-dbcs version for you.

randym pushed a commit that referenced this issue Dec 7, 2011
force binary encoding for zip entries.
[bug] fixed error in app.rb so extended properties can now be used.
improved support for OOXML cell element types.
@randym
Copy link
Owner

randym commented Dec 7, 2011

Thanks a million Tim for pointing this out.

Fix has been pushed and released in 1.0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants