C++类库LibXL从在Excel中插入行和列

这个例子显示了如何在工作表中插入行和列。请看insert.xls文件中的结果。

LibXL是一个轻量级的Excel类库,支持各类平台运行,如需使用先行点击这里下载:

#include "libxl.h"#include <stdlib.h> using namespace libxl;int main(){    Book* book = xlCreateBook();      Sheet* sheet = book->addSheet(L"Sheet1");      for(int row = 1; row < 30; ++row)    {        for(int col = 0; col < 10; ++col)        {            sheet->writeNum(row, col, rand() % 10);        }    }    sheet->insertRow(5, 10);    sheet->insertRow(20, 22);    sheet->insertCol(4, 5);    sheet->insertCol(8, 8);              book->save(L"insert.xls");    book->release();    return 0;}

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年1月3日
下一篇 2022年1月3日

相关推荐

发表回复

登录后才能评论