简体   繁体   English

运行Excel宏而不安装Excel

[英]Run Excel macro without installing Excel

Is there any way to run Excel macro from C# .Net without installing Excel? 有没有办法在不安装Excel的情况下从C#.Net运行Excel宏?

Currently I am running a macro using Excel Microsoft.Office.Interop.Excel which requires Excel to be installed on the server machine. 目前我正在使用Excel Microsoft.Office.Interop.Excel运行一个宏,它需要在服务器计算机上安装Excel。 There are some libraries such as NPOI which can be used for reading or writing Excel but not sure whether it is possible to run the macro using such libraries without installing Excel. 有一些库,如NPOI ,可用于读取或编写Excel,但不确定是否可以使用这些库运行宏而无需安装Excel。

You cannot run a macro/VBA directly without installing Excel. 如果不安装Excel,则无法直接运行宏/ VBA。

But there are some .NET libraries that can read Excel files (as you already found out). 但是有一些.NET库可以读取Excel文件(正如您已经发现的那样)。 But you will need to convert/translate your macro/VBA code into a C#.NET code that uses the library. 但是您需要将宏/ VBA代码转换/转换为使用该库的C#.NET代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM