-
Notifications
You must be signed in to change notification settings - Fork 817
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
Writer gives broken Excel File #63
Comments
Hi, sorry for the delayed response. I can't reproduce this error locally. Could you please take the following steps:
|
I have tried the code above with rev c604be9 with the same result. The software is Excel 2011 for Mac. Double clicking on the file: Excel asks me to repair the document. After repairing the document, I can see the two cells as expected. LibreOffice does not complain and opens the document without problem. This is on Mac (newest version / Yosemite) and Excel 2011 (14.4.6, latest updates) |
The result is at: |
@pgundlach that file opens correctly in LibreOffice. Can you tell me which program you're using to open it and what message it gives you? I have neither Windows nor Mac OS available to me for testing. |
Did you perhaps miss #63 (comment) ? This is on Mac (newest version / Yosemite) and Excel 2011 (14.4.6, latest updates) I only have the German localized version. Which means 'Excel could not open myfile.xlsx, because some contents is not readable. Would you like to open and repair the document?' |
@pgundlach oh sorry, yes I didn't see the previous comment! As it happens I can read German - I'm in Hannover! ;-) |
@pgundlach OK, I'll compare the file you linked above to the output from your code and see what has changed! |
@pgundlach the file you linked seems to be identical to the output from the program - could you save the repaired version and let me have it? |
@tealeg Here it is: http://download.speedata.de/private/repaired.xlsx (will be taken offline in a month or so) |
@pgundlach great, I've got it, thanks! |
@pgundlach - ok, it seems the difference is a single file "theme.xml" which doesn't exist at all in the original version of the document. Very useful information. |
@pgundlach OK, can you try again using the current version of master - the output should now match your repaired version with regards to the theme1.xml file. There's still no style information here (which could indeed be a problem), but that will start to get resolved soon. |
@pgundlach thanks. What you're doing is very helpful and I'm grateful for your patience. I've just landed the style output, which is the largest chunk of what differs between xlsx output and that from, for example LibreOffice. I've tested the output in LibreOffice, so it might help with your situation. If you get a chance to test again with what's now on the master branch I'd be interested in the results. |
i have the same question.... |
Using 339e2d2 I still get a broken Excel file (same error as above) |
@pgundlach OK. I'll keep working to make the output match that of known good files. |
@yjzhg if you could provide versions of the file your using before and after it has been repaired that would be helpful. |
Excel 2013 on windows 8.1, when opening the file , the error is: can not load /xl/styles.xml (xml syntax error); |
@nadoo - that's very helpful, thank you! |
@tealeg can you strip the whitespace outside of |
@sangeethay that's extremely interesting. The formatting is automatically generated by xml.MarshallIndent - I do that to make it easier to read the resultant XML. In principal it shouldn't cause problems, but I'd be happy to find out. I'll let you know when I've made the change. |
@sangeethay OK, if you pull from master now you should get a version of the code that doesn't add indentation or other unecessary whitespace to the file. |
Using a44cb51 - I still get the same problem. |
Hey Geoff, thanks for the great work! The reader's been super helpful. I'm running into the same corruption issue when I write files. I've tried to open them on both mac and windows versions of excel. Do you have any further insight into what's going on? I'd be happy to try and help. |
@zachyf Thanks for the kind words. As far as I can tell there's a number of small issues. The plan, as of now, is to work towards matching known good output (and reading the standard so that I can be sure I fully understand what is being expressed). It could be quite sometime until this functionality is working perfectly - particularly as I seem to need more control over the generated XML than encoding/xml's Marshal gives me. I think I've mentioned it before, but I don't actually have Excel here so I'm unable to see the problems myself. LibreOffice parses the output without error. |
Perfect, thanks for the information. I'll compare the program's output against Excel output over the next few days. l'll keep you posted if I can find discrepancies that explain the apparent corruption. |
have a try with https://github.com/nadoo/xlsx , in my condition, the output file is ok to be opened by excel 2013. |
@nadoo ok, that looks interesting! By removing the cellStyleXf and cellXf you're presumably getting an output that doesn't have any styling at all applied to the cells? The other things you've disabled seem like easy targets for removal. I've been pondering doing something similar on the mainline and making style support in output a separate branch. At least so we can have working, but minimal output. |
@tealeg yes, I think make a data output only version is a good idea, sometimes we just need to send some data to another, styles are not necessary. |
@tealeg You can use MS One Drive (Free to use, can use from Chrome on Linux) to test XLSX output. |
Thanks @kardianos, I actually started doing just that over Christmas! It's still not perfect, in that it doesn't tell me anything about what is wrong with the files, but at least it gives me some indication. |
FWIW, seeing the same on: OS X 10.10.2 And seeing the following logs after a repair
And the result is an empty file. I took a look at @nadoo's changes, however while the data was showing, unfortunately in my specific use case, styling is a requirement. I'd be happy to provide any additional information if you'd like! |
I'm getting the same issue as @BrianMMcClain |
I got the same error again,but what I have is a Chinese version. What can I do to help? |
@yupengfei The Chinese version of what, OSX? I confirmed that, using the file generated by the original post in this issue, I get an error:
No useful errors, though. |
I believe that on Mac OS X it's possible to see more information about failures in log files that Excel writes. Presumably in ~/Library/Logs/ someplace, but I don't recall all the details. |
@ShawnMilo Sorry to reply late, we use Chinese version of MS office. I have tried OSX, it can not open generated xlsx files. But MS Office can open it normally after repair it. MS Office privide some error message in Chinese. |
Thanks for the tip. I couldn't get any debug info from Numbers, but I did a lot of playing with two spreadsheets, (one working and one non-working) by copying bits from one to the other. I did find a solution. In
I'm having trouble finding where to add this to the code (grep brings back too many selections). I can narrow it down, but I wanted you to have a look in case this is a bad idea for some reason. |
@ShawnMilo I think the issue is that the normal XML marshalling in Go doesn't allow for additional namespaces to be defined in the root element of the document. The default namespace is set up by the tags on the XMLName field of the structs we marshal to/from. Because of this restriction, I believe the code currently has cases where we set the namespaces on the elements in the document, that belong to namespaces other than the default, directly. That should be valid XML, but it may not be good enough for Excel. There does seem to be some work going on to address this that may turn up in Go 1.5. Personally I'd like us to stick to using Go's XML marshalling, but if needs be I wouldn't be opposed to temporarily pulling in development versions of the library if it really is useful. Obviously with a view that these would be removed once the functionality is generally available. |
Using the following file with version d6607c5 I get a broken Excel file. How can I write multiple rows?
The text was updated successfully, but these errors were encountered: