我有什么选择来读取Excel文件和评估C#,Java和PHP中的公式?

时间:2022-06-22 20:56:43

I've seen various means of reading (and writing) Excel spreadsheets. For example:

我已经看过各种阅读(和编写)Excel电子表格的方法。例如:

But I'm interested in more than just reading/writing Excel files. I want something where I can evaluate arbitrary Excel formulas. So far in this vein I've seen:

但我感兴趣的不仅仅是阅读/编写Excel文件。我想要一些可以评估任意Excel公式的东西。到目前为止,我已经看到:

  • C# Excel Interop, although this seems to require that you have Excel running; and
  • C#Excel Interop,虽然这似乎要求你运行Excel;和

  • POI-HSSF: this formula support seems incomplete.
  • POI-HSSF:这个公式支持似乎不完整。

Are there better options or is that it?

有更好的选择还是它?

3 个解决方案

#1


SpreadsheetGear for .NET is compatible enough with Excel that Microsoft uses it to calculate Excel based calculators on their MSN Money web site.

SpreadsheetGear for .NET与Excel完全兼容,Microsoft使用它在MSN Money网站上计算基于Excel的计算器。

#2


If you're only targeting the windows platform, you really have no substitute for running Excel, and controlling it via a COM bridge.

如果您只是针对Windows平台,那么您无法替代运行Excel并通过COM桥控制它。

As you are finding, any other solution is likely to be

正如您所发现的,任何其他解决方案都可能是

  • incomplete, and/or
  • incompatible and/or
  • inconsistent

with Excel.

Unfortunately, this does add a dependency on Excel to your software.

不幸的是,这确实增加了对Excel软件的依赖性。

#3


If you want to evaluate Excel formulae, frankly Excel is the only reliable way to do this. So running Excel via a COM bridge is the way to go.

如果要评估Excel公式,坦率地说Excel是唯一可靠的方法。因此,通过COM桥运行Excel是可行的方法。

I've done this before in Java using JACOB and that works very nicely. Excel looks after all the functionality. You just have to populate your spreadsheet (in memory) and let Excel do the rest.

我以前在使用JACOB的Java中完成了这个,并且非常好用。 Excel负责所有功能。您只需填充电子表格(在内存中),让Excel完成剩下的工作。

#1


SpreadsheetGear for .NET is compatible enough with Excel that Microsoft uses it to calculate Excel based calculators on their MSN Money web site.

SpreadsheetGear for .NET与Excel完全兼容,Microsoft使用它在MSN Money网站上计算基于Excel的计算器。

#2


If you're only targeting the windows platform, you really have no substitute for running Excel, and controlling it via a COM bridge.

如果您只是针对Windows平台,那么您无法替代运行Excel并通过COM桥控制它。

As you are finding, any other solution is likely to be

正如您所发现的,任何其他解决方案都可能是

  • incomplete, and/or
  • incompatible and/or
  • inconsistent

with Excel.

Unfortunately, this does add a dependency on Excel to your software.

不幸的是,这确实增加了对Excel软件的依赖性。

#3


If you want to evaluate Excel formulae, frankly Excel is the only reliable way to do this. So running Excel via a COM bridge is the way to go.

如果要评估Excel公式,坦率地说Excel是唯一可靠的方法。因此,通过COM桥运行Excel是可行的方法。

I've done this before in Java using JACOB and that works very nicely. Excel looks after all the functionality. You just have to populate your spreadsheet (in memory) and let Excel do the rest.

我以前在使用JACOB的Java中完成了这个,并且非常好用。 Excel负责所有功能。您只需填充电子表格(在内存中),让Excel完成剩下的工作。