什么是使用Excel文件的简单可靠的C库? [英] What is a simple and reliable C library for working with Excel files?

查看:100
本文介绍了什么是使用Excel文件的简单可靠的C库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,就是这样。



我需要一些简单可靠(不必具有奇特的功能 - 我需要写和从Excel单元格读取文本和数字)



是的,我想要一个示例Hello Cell代码 ...



你推荐什么?

解决方案

非常气馁。我建议使用C-friendly格式(例如CSV)而不是XLS,或使用新的 XML 格式(请选择XML和ZIP库)。



但是,为了快速修复,您可以导出为引用的CSV,然后使用 VBScript 导入。像这个,虽然我会尝试让它工作请注意,这将需要Office的副本,并且不会扩展(但您可以隐藏Excel窗口)。我刚刚发现 xlsLib ,所以如果你真的需要直接在C中写,去吧!请注意,因为很难正确,特别是如果您正在写入已存在的文件。



还存在 LibExcel ,但这是C ++,所以你需要编译一个包装器,或者重写C。






最后一个警告:我一开始并没有搜索这些内容的原因是,找到权利是非常困难的。我没有使用上面的图书,但我怀疑他们会以奇怪和不寻常的方式打破。我相信您已阅读 Joel的采用Office格式。


Well... that's it.

I need something simple and reliable (doesn't have to have fancy features - I need to write and read text and numbers from Excel cells)

And yes, I would like a sample "Hello Cell" code...

What do you recommend?

解决方案

Strongly discouraged. I'd recommend using a C-friendly format (e.g. CSVs) instead of XLS, or using the new XML formats (take your pick on XML and ZIP libraries).

Still, for a quick fix, you could export to quoted CSV and then import using VBScript. Something like this, although I'd try to get it to work in VBA first.

Note that this will require a copy of Office, and will not scale well (but you can hide the Excel window).


I've just found xlsLib, so if you really need to write directly in C, give it a go! Be careful though, because it's very hard to get right, especially if you're writing to already-existing files.

There also exists LibExcel, but that's C++, so you'd need to compile a wrapper around, or rewrite for C.


One final caveat: the reason I didn't search for these at the start is that it's extremely difficult to get right. I have not used the libraries above, but I suspect they'll break in strange and unusual ways. I trust you've read Joel's take on the Office formats.

这篇关于什么是使用Excel文件的简单可靠的C库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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