Joh*_*ruz 12 c# vb.net binary sharepoint xls
我有一个客户需要将XLS文件转换为XLSB.有没有人以编程方式完成此操作(有或没有附加组件---无所谓 - 只需要能够自动化它)?我正在寻找一种自动化方法.
作为旁注,客户问的是因为他们使用Sharepoint,而且它似乎有办法比XLS更快更容易地分析XLSB文件?我正在努力提高我的Sharepoint知识,但与此同时,我正试图找到这个XLSB问题的答案.
Pet*_*lin 16
那么,有一个短格式verison:
using Microsoft.Office.Interop.Excel;
// init excel
Application excelApplication = new Application();
// ...
// open book in any format
Workbook workbook = excelApplication.Workbooks.Open("1.xls", XlUpdateLinks.xlUpdateLinksNever, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
// save in XlFileFormat.xlExcel12 format which is XLSB
workbook.SaveAs("1.xlsb", XlFileFormat.xlExcel12, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
// close workbook
workbook.Close(false, Type.Missing, Type.Missing);
// ...
// shutdown excel
excelApplication.Quit();
Run Code Online (Sandbox Code Playgroud)
您将需要具有.NET编程支持的Excel安装(默认情况下在安装程序中禁用!)并从您的项目引用Excel的MS Office PIA程序集:
参考资料: Workbooks.Open,workbook.SaveAs,XlFileFormat.xlExcel12