Qt 读写Execl libxl
官方资料及代码示例
Direct reading and writing Excel files
LibXL is a library that can read and write Excel files. It doesn’t require Microsoft Excel and .NET framework, combines an easy to use and powerful features. Library can be used to
- Generate a new spreadsheet from scratch
- Extract data from an existing spreadsheet
- Edit an existing spreadsheet
LibXL can help your applications in exporting and extracting data to/from Excel files with minimum effort. Also it can be used as report engine. Library can be used in C, C++, C#, Delphi, PHP, Python, PowerBASIC, Xojo, Fortran and other languages. Supports Excel 97-2003 binary formats (xls) and Excel 2007-2016 xml formats (xlsx/xlsm). Supports Unicode and 64-bit platforms. There are a wrapper for .NET developers and separate Linux, Mac and iOS editions. See features of the library in demo.xls or demo.xlsx files.
Simple interoperate, no more Excel dependency
LibXL has C/C++ headers, Delphi unit and .NET assembly for including in your project. No OLE automation.
High performance
Writing speed is about 2 100 000 cells per second for numbers and 240 000 cells per second for 8-character random strings in binary xls format (CPU 3.2 GHz).
Royalty-free distribution with your application
Our customers can use this library in their commercial applications without any additional fees.
官网资料 www.libxl.com
下载传送门:libxl 下载
Code example - C
#include "libxl.h"
int main()
{
BookHandle book = xlCreateBook(); // xlCreateXMLBook()
if(book)
{
SheetHandle sheet = xlBookAddSheet(book, L"Sheet1");
if(sheet)
{
xlSheetWriteStr(sheet, 2, 1, L"Hello, World !", NULL);
xlSheetWriteNum(sheet, 3, 1, 1000, NULL);
}
xlBookSave(book, L"example.xls");
xlBookRelease(book);
}
return 0;
}
Code example - C++
#include "libxl.h"
using namespace libxl;
int main()
{
Book* book = xlCreateBook(); // xlCreateXMLBook() for xlsx
if(book)
{
Sheet* sheet = book->addSheet(L"Sheet1");
if(sheet)
{
sheet->writeStr(2, 1, L"Hello, World !");
sheet->writeNum(3, 1, 1000);
}
book

这篇博客介绍了如何使用LibXL库在C++、C#、Delphi和Qt中读写Excel文件。LibXL是一个无需依赖Microsoft Excel和.NET框架的库,支持创建、提取和编辑Excel文件。提供了详细的代码示例,包括在Qt环境中进行文件读取和写入的方法。此外,还提到了库的使用注意事项,如未注册时的限制。
最低0.47元/天 解锁文章
3570

被折叠的 条评论
为什么被折叠?



