我正在使用OpenXMl生成Excel文件(.xlsx)。我可以在计算机上打开生成的文件(.xlsx),但无法在Ipad上打开它。它甚至没有密码保护,但确实收到912错误。

这是我的C#代码

string fileName = "Report.xlsx";
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";// "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"; //"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" '"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" '"application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);


任何帮助将不胜感激。

最佳答案

您是否尝试过使用第三方工具(例如ClosedXML)生成所需的.xlsx文件?

我们最近使用过它,实施需要15分钟:也许您可以尝试一下。
如果问题与未完全遵守OpenXml格式有关,则也许ClosedXml可以做得更好...

http://closedxml.codeplex.com/

08-26 16:34