C++读写excel文件的的第三方库

文章列举了多个用于读写MicrosoftExcel文件的C++库,包括OpenXLSX、xlnt、libxl、BasicExcel、QtXlsxWriter、EasyXLS和SPLib等,分别介绍了它们的特点和适用场景。这些库支持不同的Excel格式和功能,从基础的数据读写到复杂的格式和公式处理。此外,还提到了其他解决方案,如Aspose.Cells和一些开源项目。
摘要由CSDN通过智能技术生成

一、比较流行的库

1. OpenXLSX

用于读取、写入、创建和修改 Microsoft Excel® (.xlsx) 文件的 C++ 库。

2. xlnt

xlnt 是一个现代 C++ 库,用于操作内存中的电子表格以及从 XLSX 文件读取/写入它们,如ECMA 376 第 4 版中所述。xlnt 1.0 版的首次公开发布是在 2017 年 5 月 10 日。目前的工作重点是增加兼容性、提高性能以及集思广益未来的发展目标。

参考链接:
VS2022编译xlnt库
C++读写Excel(xlnt库的使用)

3. libxl

LibXL 是一个可以读写 Excel 文件的库。它不需要 Microsoft Excel 和 .NET 框架,结合了易于使用和强大的功能。LibXL 可以帮助您的应用程序轻松地将数据导出到 Excel 文件或从中提取数据。它还可以用作报表引擎。库可用于C、C++、C#、Delphi、PHP、Python、PowerBASIC、Xojo、Fortran等语言。支持 Excel 97-2003 二进制格式 (xls)、Excel 2007-2021 XML 格式 (xlsx/xlsm)。支持 Unicode 和 64 位平台。有一个面向 .NET 开发人员的包装器和单独的 Linux、Mac 和 iOS 版本。在demo.xls或demo.xlsx文件中查看库的功能。

4. BasicExcel

在深入研究 之前BasicExcel,让我们先看看它的局限性。它被称为BasicExcel 是有原因的。
不支持格式化:

  • 不支持公式
  • 它不支持图表
  • 它不支持 Unicode UTF-32

实际上它不支持 Excel 的许多奇特功能。它旨在成为一个基本类,用于将数字和字符串等简单内容读写到电子表格中。
支持的功能:

  • 读写数字(整数、实数)和字符串(ANSI、UTF16)
  • 添加工作表
  • 重命名工作表
  • 删除工作表
  • 获取工作表的名称

5. QtXlsxWriter

QtXlsx是一个可以读写Excel文件的库。它不需要 Microsoft Excel,可以在 Qt5 支持的任何平台上使用。该库可用于

  • 从头开始生成一个新的 .xlsx 文件
  • 从现有的 .xlsx 文件中提取数据
  • 编辑现有的 .xlsx 文件

7. EasyXLS

https://www.easyxls.com/manual/tutorials/cpp/read-xlsx-file.html

8. ExcelFormat

https://www.codeproject.com/Articles/42504/ExcelFormat-Library

9. SPLib

SPLib 是一个开源 (BSD) C++ 库,用于导出各种格式的电子表格,并支持不同的单一格式。

二、其他解决方案

https://www.bbsmax.com/A/ke5jeN7OJr/
http://t.csdn.cn/vs54S
https://products.aspose.com/cells/cpp/
https://github.com/huangfeidian/xlsx_reader
https://github.com/qcdong2016/MiniExcel

这是曾经做过的一个项目时写的一个动态库,用c++来操作Excel,包括以下功能: //===================================mainly function============================ //FuncName: xls_create //function: create excel server //return value: return 1 if success, otherwise 0 _export bool xls_create(); //FuncName: xls_new_file/xls_new_file2 //function: create an excel file (from a template) //parameter: strTemplate ->excel template file name,eg: "template.xlt" or "d:\teplate.xls" // strFileName ->the file name used to save excel file as,eg: "Temp.xls" // openfile ->1: open excel file after writen it,otherwize don't open it //return value: return the excel fileID which created from template, between 1 and 256 if success, or zero otherwise _export int xls_new_file(char* szTemplate, char* szFileName, int openfile); _export int xls_new_file2(char* szFileName, int openfile); //FuncName: xls_open_file //function: Open an exist excel file //parameter:the file name will to be opened //return value: return the fileID, if open file success,otherwize return 0 _export int xls_open_file(char* szFileName); //FuncName: xls_write_xxx //function: write a double value to xls file //parameter: fileID ->the excel file ID which we will write the value into,between 1 and 256 // sheetID ->the sheet index of the excel file which we will write the value into,between 1 and 256 // crow ->the row index which we will write the value into, not less 1 // ccol ->the column index which we will write the value into, not less 1 // value ->the double value which we will write into excel //Note: if you want to input enter key in excel file,you may use \n in your str //return value: return 1 if success, otherwise 0 _export int xls_write_str(int fileID, int sheetID, int crow, int ccol, char* value); _export int xls_write_dbl(int fileID, int sheetID, int crow, int ccol, double value); _export int xls_write_int(int fileID, int sheetID, int crow, int
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值