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();
相关文章:
- 可将PDF转为Excel格式转换软件 2021-12-28
- 将DATAGRID的数据导出为一个标准EXCEL格式的文件 2022-02-01
- 如何在Java中将Excel转化为XML格式文件 2022-12-23
- 将JSON文件转换为Excel 2022-01-26
- 将Excel文件转换为Html 2022-03-08
- Excel文件保存为XML格式 2022-12-23
- 通过XML转换下载.xlsx格式的excel文件 2022-12-23