问题描述
在我们的应用程序中,我们使用EPPlus创建excel 2007文件。但是根据客户要求,我们必须为相同的数据创建一个excel 2003文件生成函数。我们使用OpenXML创建excel 2003文件。现在我想出了两种格式使用相同的excel 2007或xlsx文件的想法。所以我使用以下代码将文件保存为xls。
Hi,
In our application we have used EPPlus to create excel 2007 files. But as per client requirement we had to create an excel 2003 file generation function for same data. We used OpenXML to create excel 2003 file. Now I came up with idea to use the same excel 2007 or xlsx file for both formats. So I used the following code to save the file as xls.
string path = @"D:\" + filename + DateTime.Now.ConvertDateToYYYYMMDD() +".xls";
Stream stream = File.Create(path);
pck.SaveAs(stream);
stream.Close();
这里pck是我用来创建xls文件的EPPlus包。我认为它会破坏,因为EPPlus不支持xls文件。但是当我在excel 2007中打开它时,它打开了很好。但目的没有解决,因为如果我在Excel 2003中打开文件,它会显示一个损坏的文件。
我现在正考虑将excel 2007文件转换为openxml格式,然后再将其转换为excel 2003文件,将其作为openxml xls文档提供,可以打开excel 2003.请显示一些路径。
Here pck is the EPPlus package which i used to create xls file. I thought it would break because EPPlus doesn't support xls files. But when I opened it in excel 2007 it opens up fine. But the purpose is not solved, because if I open the file in Excel 2003 it shows a corrupted file.
I am now thinking of converting the excel 2007 file to openxml format and then again convert it to excel 2003 file to serve it as openxml xls document which can be opened in excel 2003. Please show some path over this.
推荐答案
这篇关于如何将excel 2007文件转换为excel 2003的openxml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!