以编程方式修改excel电子表格的最佳方式 [英] best way to programmatically modify excel spreadsheets

查看:144
本文介绍了以编程方式修改excel电子表格的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个库,允许我以编程方式修改Excel文件,以便向某些单元格添加数据。我目前的想法是使用命名范围来确定插入新数据的位置(本质上是1x1的范围),然后将命名范围更新为指向数据。这个将要整合的现有应用程序完全用C ++编写,所以我理想地寻找一个C ++解决方案(因此为什么这个线程的有用性有限)。如果一切都失败了,如果有一些方法将它与我们的C ++应用程序进行链接,我将使用.NET解决方案。

I'm looking for a library that will allow me to programatically modify Excel files to add data to certain cells. My current idea is to use named ranges to determine where to insert the new data (essentially a range of 1x1), then update the named ranges to point at the data. The existing application this is going to integrate with is written entirely in C++, so I'm ideally looking for a C++ solution (hence why this thread is of limited usefulness). If all else fails, I'll go with a .NET solution if there is some way of linking it against our C++ app.

一个理想的解决方案是开源,但是目前为止我看不到任何一个( MyXls XLSSTREAM )似乎面临挑战。我喜欢 Aspose.Cells ,但它适用于.NET或Java,而不是C ++(并且花费钱)。我需要支持从97到现在的所有Excel格式,包括XLSX和XLSB格式。理想情况下,它还将支持OpenOffice和(用于输出)PDF和HTML格式。

An ideal solution would be open source, but none of the ones I've seen so far (MyXls and XLSSTREAM) seem up to the challenge. I like the looks of Aspose.Cells, but it's for .NET or Java, not C++ (and costs money). I need to support all Excel formats from 97 through the present, including the XLSX and XLSB formats. Ideally, it would also support formats such as OpenOffice, and (for output) PDF and HTML.

我需要支持的一些用例:

Some use-cases I need to support:


  • 阅读和修改电子表格中的任何单元格,包括公式

  • 创建,阅读,修改命名范围(范围本身,不仅仅是单元格)

  • 将格式从单元格复制到其他一些(包括条件格式) - 我们将使用一个单元格作为我们填写的所有其他单元格的模板数据。

任何可以帮助我找到合适的图书馆的帮助将是很棒的。我也想听听有关各种建议(包括我的帖子)的一些推荐,所以我可以做出更明智的决定 - 什么是易于使用,无bug,便宜等?

Any help you can give me finding an appropriate library would be great. I'd also like to hear some testimonials about the various suggestions (including the ones in my post) so I can make more informed decisions -- what's easy to use, bug-free, cheap, etc?

推荐答案

我最终使用Aspose.Cells,就像我原来的帖子中提到的,因为它似乎是最简单的路径。我感到非常高兴,他们的支持非常好。我不得不在C#中创建一个包装器,它将COM接口导出到我的C ++应用程序。

I ended up using Aspose.Cells as I mentioned in my original post, since it seemed like the easiest path. I'm very happy with the way it turned out, and their support is very good. I had to create a wrapper around it in C# that exported a COM interface to my C++ application.

这篇关于以编程方式修改excel电子表格的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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