0

我正在尝试将 excel 表导出到 xml 电子表格 2003 中,以便在结果 xml 文件上应用一些 xsl,

所以,我尝试使用 XlFormat 枚举来保存我正在处理的工作表,如下所示:

Excel.Application app = new Excel.Application();
Excel.Workbook workbook;
Excel.Worksheet NwSheet;
workbook = app.Workbooks.Open(@"C:\file.xlsx",
                          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                          Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                          Type.Missing, Type.Missing);
NwSheet = (Excel.Worksheet)workbook.Sheets.get_Item(1);

string outfile = @"c:\temp.xml";
NwSheet.SaveAs(outfile, Excel.XlFileFormat.xlXMLSpreadsheet, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

此代码生成的 xml 文件存在以下问题:

1 个日期类型的单元格生成为:2011-10-10T00:00:00.000,我希望它是 2011 年 10 月 10 日,就像它在 excel 表中一样,所以我如何访问这些单元格的类型以便改变他们??

2-数字 8.2 生成为 8.1999999999999993 为什么会发生这种情况,我怎样才能得到它,就像它在 excel 表中一样

我想两者都是同一个问题的面孔,我只需要出现在 excel 表中的数据。

4

0 回答 0