本文介绍了OpenXML Excel文件,适用于Excel 2007,OpenOffice等,但不适用于Excel 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我遇到了问题。  我主持一个免费网站,与其他开发者共享源代码和想法。  我的一个项目是一个非常简单的C#类,它生成一个Excel 2007 .xlsx文件。  提供所有源代码,以及免费显示
如何使用它的演示。  无需注册。

I have a problem.  I host a free website, sharing source code and ideas with other developers.  One of my projects is a very simple C# class, which generates an Excel 2007 .xlsx file.  All source code is provided, along with a demo showing how to use it, free of charge.  No registration required.

此类生成的.xlsx文件很好,它们在Excel 2007和Excel中打开。 OpenOffice,我在文件上运行了 OpenXmlValidator
,并且没有报告问题。

The .xlsx files that this class generates are fine, they open in Excel 2007 & OpenOffice, I've run the OpenXmlValidatoron the files, and there are no reported problems.

但是,如果我打开文件Excel 2010(带SP1)打开,但如果我转到"打印"或"打印预览"屏幕,Excel 2010将崩溃。  

However, If I open the file in Excel 2010 (with SP1), it opens, but if I go to the Print or Print Preview screen, Excel 2010 crashes.  

谷歌搜索,我发现许多许多用户遇到了HP打印驱动程序的问题,我遵循了一些建议,例如关闭多个在Excel中进行线程处理,但没有区别。  我尝试将默认打印机设置为
"Microsoft XPS Document Writer",但没有区别。

Googling around, I've found that many many users have experienced problems with HP print drivers, I followed some suggestions, such as turning off multi-threading in Excel, but it makes no difference.  I tried setting the default printer as the "Microsoft XPS Document Writer", but it made no difference.

这是我的演示生成的Excel文件的副本(并且崩溃了Excel 2010)。  有人可以告诉我为什么它打开没关系,但随后崩溃Excel 2010?  

Here is a copy of the Excel file that my demo produces (and which crashes Excel 2010).   Can someone tell me why it opens okay, but then crashes Excel 2010 ?  

可以通过在Excel 2010中加载此文件来解决此问题,并将其另存为".xls"。文件(!!)并重新加载...但它有点挫败了目的。

I can get around the problem by loading this file in Excel 2010, saving it as an ".xls" file (!!) and re-loading that... but it kinda defeats the purpose.

而且,更一般地说,为什么Excel 2007年,OpenOffice和OpenXmlValidator认为它的格式正确,但它崩溃了Excel 2010?  我很惊讶Excel 2010至少没有尝试用Excel
文件报告某种问题,而不是轰炸。

And, more generally, why does Excel 2007, OpenOffice and the OpenXmlValidator consider it to be in the correct format, but it crashes Excel 2010 ?  I'm surprised that Excel 2010 doesn't at least attempt to report some kind of problem with the Excel file, rather than bombing out.

迈克

推荐答案

感谢您在MSDN论坛上发帖。

Thanks for posting in the MSDN Forum.

我可以打开
http://www.MikeKnowledgeBase.com/SampleCode/Sample.xlsx 。您能否在skydrive上分享您的电子表格文档以供进一步研究?

I can open the link of http://www.MikeKnowledgeBase.com/SampleCode/Sample.xlsx due to proxy issue. Would you please share you spreadsheetdocument on skydrive for further research?

祝您有个美好的一天,

Tom


这篇关于OpenXML Excel文件,适用于Excel 2007,OpenOffice等,但不适用于Excel 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 09:42