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

Problem opening file in Excel Viewer #1

Closed
pepawel opened this issue Aug 29, 2011 · 16 comments
Closed

Problem opening file in Excel Viewer #1

pepawel opened this issue Aug 29, 2011 · 16 comments

Comments

@pepawel
Copy link

pepawel commented Aug 29, 2011

Hi,

I've downloaded latest Excel viewer to check if generated file is recognized. It is not. Excel Viewer gives error that the file is incorrect.

File is created using RubyXL::Workbook.new.write 'text.xlsx'

Openoffice and ZohoSheet recognizes file properly.

@pepawel
Copy link
Author

pepawel commented Aug 29, 2011

It appears the file can be read in Excel, but it reports (and fix) errors.

@pepawel
Copy link
Author

pepawel commented Aug 29, 2011

Excel complains about xl/workbook.xml and xl/worksheets/sheet1.xml

@amanfredi
Copy link
Collaborator

Does this also happen if you open an existing (good) excel file and save it through rubyXL, or only when rubyXL creates a blank file?

@pepawel
Copy link
Author

pepawel commented Sep 20, 2011

Hi, I've switched to another gem (simple_xlsx_writer) and currently I've not time to debug this problem. I'm sorry, I won't be able to help you with this bug :/

@amanfredi
Copy link
Collaborator

This should be fixed in version 1.1.10

@anathematic
Copy link

It looks like I'm having the same issue using version 1.1.10 - opening a valid excel file and writing to it again gives me

"Excel found unreadable content in "text1.xlsx". Do you want to remove the contents of this workbook? If you trust the source of this workbook, click Yes"
then
"Excel was able to open the file by repairing or removing unreadable content" on yes.

Here's the log output:

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error051680_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\Thomas\Documents\My Dropbox\test1.xlsx'</summary>-<repairedParts summary="Following is a list of repairs:"><repairedPart>Repaired Part: /xl/worksheets/sheet1.xml part with XML error. Load error. Line 2, column 459.</repairedPart><repairedPart>Repaired Part: /xl/worksheets/sheet2.xml part with XML error. Load error. Line 2, column 459.</repairedPart><repairedPart>Repaired Part: /xl/worksheets/sheet3.xml part with XML error. Load error. Line 2, column 459.</repairedPart></repairedParts>-<removedFeatures summary="Following is a list of removed features:"><removedFeature>Removed Feature: View from /xl/worksheets/sheet1.xml part</removedFeature><removedFeature>Removed Feature: View from /xl/worksheets/sheet2.xml part</removedFeature><removedFeature>Removed Feature: View from /xl/worksheets/sheet3.xml part</removedFeature></removedFeatures></recoveryLog>

Also - my excel file

@anathematic
Copy link

I have more information, here's the xml:

<?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" xmlns:mv="urn:schemas-microsoft-com:mac:vml" mc:Ignorable="mv" mc:PreserveAttributes="mv:*"><dimension ref="A1:B2"/><sheetViews><sheetView tabSelected="1" view="normalLayout" workbookViewId="0" zoomScale="100" zoomScaleNormal="100"></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="13"/><sheetData><row r="1" spans="1:2" customFormat="0" s="0"><c r="A1" s="0" t="s"><v>0</v></c><c r="B1" s="0" t="s"><v>0</v></c></row><row r="2" spans="1:2" customFormat="0" s="0"><c r="A2" s="0" t="s"><v>0</v></c><c r="B2" s="0" t="str"><v>what</v></c></row></sheetData><sheetCalcPr fullCalcOnLoad="1"/><phoneticPr fontId="1" type="noConversion"/><pageMargins left="0.75" right="0.75" top="1" bottom="1" header="0.5" footer="0.5"/><pageSetup orientation="portrait" horizontalDpi="4294967292" verticalDpi="4294967292"/></worksheet>

And I believe the cause is the self-ending sheetView:
<sheetView tabSelected="1" view="normalLayout" workbookViewId="0" zoomScale="100" zoomScaleNormal="100"/>

I have no idea how to zip my xlsx back up to test - so I'll fiddle a little longer but hopefully this give you some insight to the cause of the issue.

@anathematic
Copy link

(Actually I just realised I've misread the tag and that's not the issue - I now have no idea but hope I've given you some ideas)

@amanfredi amanfredi reopened this Oct 18, 2011
@amanfredi
Copy link
Collaborator

I've found the Microsoft OOXML SDK tool to be somewhat helpful in tracking down these errors.

http://www.microsoft.com/download/en/details.aspx?id=5124

Give it a shot at validating your file and it might tell you what rubyXL is doing wrong (or give you an unhelpful error message, who knows?).

I'll look at your file tomorrow, also.

@anathematic
Copy link

Cheers, will investigate!

@amanfredi
Copy link
Collaborator

I'm not getting any errors from this file. Is this the one you repaired?

Also, what version of excel are you using?

@anathematic
Copy link

Extremely sorry about the delay - this is for a client project and I was caught up in another branch the rest of the week.

Looks like this issue is only in Office 2007 - 03 and 10 (mac) are not reporting this issue, I had a look at the XML productivity tool and found some things:
xml productivity tool

I've since found I don't need to support 2007 in this instance so it's no longer an issue for me - let me know if you'd like some more information to help debug this.

Cheers for the gem btw, saved me a lot of hassle :-)

@aprajnaparamita
Copy link

I think I'm experiencing the same issue on Mac, when I do the following:

require 'rubyXL'
workbook = RubyXL::Workbook.new
workbook.worksheets << RubyXL::Worksheet.new('pirates')
workbook.worksheets[0].add_cell(0,0,'Are great!')
workbook.write "dickerydock.xlsx"

On opening this I get:

http://d.pr/QE4r

And the recovery log says:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
  <logFileName>Repair Result to dickerydock 06954.xml</logFileName>
  <summary>Errors were detected in file 'Macintosh
  HD:Users:jjeffus:dev:test:dickerydock.xlsx'</summary>
  <repairedRecords summary="Following is a list of repairs:">
    <repairedRecord>Repaired Records: Worksheet properties from
    /xl/workbook.xml (Workbook)</repairedRecord>
  </repairedRecords>
</recoveryLog>

The recovered workbook has all the sheets but is missing the sheet names. Not sure what the issue is, using rubyXL 1.2.5 on ruby 1.9.2p290.

@aviscasillas
Copy link

jeffuus, I'm experiencing the same as you.

I tried this and it works:
workbook.worksheets << RubyXL::Worksheet.new(workbook,'Sheet2')

I think that the problem is that Worksheet initializer expects the workbook. I've forked the project and l'm going to add a "create_worksheet" method to the Workbook class.

@maxstudener
Copy link

+1

@weshatheleopard
Copy link
Owner

"normalLayout" is indeed invalid value for "view" property. I have fixed this.

aliismayilov pushed a commit to aliismayilov/rubyXL that referenced this issue Mar 9, 2021
aliismayilov pushed a commit to aliismayilov/rubyXL that referenced this issue Mar 9, 2021
aliismayilov pushed a commit to aliismayilov/rubyXL that referenced this issue Mar 9, 2021
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

7 participants