libxl4.2.0安装包(结尾),一文教你libxl4.2.0怎么用(含所有权限),windows与linux,详细用法

用法:

官网下载4.2.0版本的库,选DOWNLOAD即可下载

然后根据自己的情况添加库

下面说一下key的用法:

如果你用的是vs,就用下图的用法,在setkey后面填写相关信息就行

VS模式

用libxl写 

#include "libxl.h"
using namespace libxl;

int main()
{
    Book* book = xlCreateXMLBook();
    book->setKey(name, key);
    if (book)
    {
        Sheet* sheet = book->addSheet(L"Sheet1");
        if (sheet)
        {
            for (int i = 1; i < 1000; i++)
            {
                sheet->writeStr(i, 2, L"Hello, World !");
            }

        }
        book->save(L"example.xlsx");
        book->release();
    }
    return 0;
}

用libxl读 

#include <iostream>
#include "libxl.h"
#include <iostream>
#include <locale.h>
#include <windows.h>
using namespace libxl;

#pragma comment(lib,"libxl.lib")

using namespace libxl;
using namespace std;


void WcharToString(string& szDst, const wchar_t* wchar)
{
    DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wchar, -1, NULL, 0, NULL, FALSE);
    char* psText;
    psText = new char[dwNum];
    WideCharToMultiByte(CP_OEMCP, NULL, wchar, -1, psText, dwNum, NULL, FALSE);
    szDst = psText;
    delete[]psText;
}
int main()
{
    Book* book = xlCreateXMLBook();
    book->setKey(name, key);

    if (book)
    {
        if (book->load(L"example.xlsx"))
        {

            Sheet* sheet = book->getSheet(0);
            if (sheet)
            {
                for (int i = 1; i < 1000; i++)
                {
                    const wchar_t* chars = sheet->readStr(i, 2);

                    string str;
                    WcharToString(str, chars);
                    std::cout << str <<std::endl;
                }
            }
        }

        book->release();
    }

    return 0;
}

 

如果你用的是QT,就用下图的用法,在setkey后面填写相关信息就行

QT模式

        Book* book = xlCreateXMLBook();  // Book for xlsx
        book->setKey(QString(name).toStdWString().c_str(), QString(key).toStdWString().c_str());

包含windows与linux的

懂的都懂

libx4.2.0的库 链接: libxl4.2.0
提取码:0914 


需要key的可以联系我

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

高山仰止_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值