public static void ConvertExcel(string savePath)
{
//将xml文件转换为标准的Excel格式
Object Nothing = Missing.Value;//由于yongCOM组件很多值需要用Missing.Value代替
Excel.Application ExclApp = new Excel.ApplicationClass();// 初始化
Excel.Workbook ExclDoc = ExclApp.Workbooks.Open(savePath, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing);//打开Excl工作薄
try
{
Object format = Excel.XlFileFormat.xlWorkbookNormal;//获取Excl 2007文件格式
ExclApp.DisplayAlerts = false;
ExclDoc.SaveAs(savePath, format, Nothing, Nothing, Nothing, Nothing, Excel.XlSaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing);//保存为Excl 2007格式
}
catch (Exception ex) { }
ExclDoc.Close(Nothing, Nothing, Nothing);
ExclApp.Quit();

相关文章:

  • 2021-06-27
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2021-11-19
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2022-02-15
  • 2021-10-22
  • 2022-12-23
  • 2021-12-13
  • 2022-02-01
相关资源
相似解决方案