使用Excel Interop将XLSX,XLSM,XLS转换为XLSB格式. [英] Converting XLSX, XLSM , XLS to XLSB format withouht using Excel Interop.

查看:626
本文介绍了使用Excel Interop将XLSX,XLSM,XLS转换为XLSB格式.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要一些紧急帮助/帮助来解决我的C#应用​​问题. (将XLS *转换为XLB格式)在我的Dev机器上可以正常工作,但是在Server上失败.

I need some URGENT assistance / help insresolving my issue with a C# app  (converters from XLS* to XLB format) , works fine on my Dev machine , however, fails on Server.

仅在服务器上部署后,我才意识到MS Office是Excel Interop正常运行所必需的,由于合规性/审核/许可问题,不能在所有服务器上安装MS Office(超过100个).

Only after deploying on server, I realised that MS Office is mandatory for Excel Interop to work , due to compliance / audit / license issue , MS office cannot be installd on all servers ( 100+).

我的问题,还有什么其他方法可以使我的程序正常运行而无需在服务器上安装MS OFfice?请注意以下几点.

My question ,  is there any other way to make my program work without installing MS OFfice on servers?   Please note the following.

1)Converter用户使用Excel Interop转换文件.

1) Converter users Excel Interop for converting files.

2)XLB formt在2007年被用作最有效的格式(以节省空间并增加负载/保存).

2) XLB formt is being used as most efficien format with 2007 ( to save space and increase load / save).

3)由于自发的原因,我无法压缩文件(zip),我需要以.xlsb格式保存文件,而无需在MS Office上安装 服务器.

3) Due to autid reasons, I cannot compress file ( zip), I need to save files in .xlsb format without installing MS office on  servers.

任何建议,替代方法都会有很大帮助.

Any suggestion , alternatives would be great help.

推荐答案

没有很多好的选择.

There are not many great alternatives for you.

有第三方选项,但我想您会遇到关于在服务器上不加载软件的同样反应.

There are third party options but I imagine you will face the same response about not loading software on the server.

另一种选择是获取excel文档使用的确切XML模式,并将其转换为所需的XML scehma.

Another option is to get the exact XML schema that excel documents use and convert it to the XML scehma you want.

最幸运的是,我知道所有的excel转换方法都使用与此非常相似的代码.

Best of luck all of the excel conversion methods I know use code very similar to this.

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();



这篇关于使用Excel Interop将XLSX,XLSM,XLS转换为XLSB格式.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆