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

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

问题描述

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

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.

一些用例我需要支持:


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

  • 创建,读取,修改命名范围不仅仅是单元格)

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

任何帮助你可以给我找一个合适的图书馆将是伟大的。我也想听听一些关于各种建议(包括我的帖子中的)的推荐,所以我可以做出更明智的决定 - 易于使用,无错误,便宜等等。

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天全站免登陆