linux 数据 excel,尝试:在linux下解析excel数据

【前言】先赞一个,这种变态的需求。

Direct reading and writing Excel files

LibXL is a library that can read and write Excel files. It doesn't require Microsoft Excel and 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 ever as report engine. Library can be used in C, C++, C#, Delphi, Fortran and other languages. Supports Excel 97-2003 binary formats (xls) and Excel 2007/2010 xml formats (xlsx). Supports Unicode and 64-bit platforms. There are a wrapper for .NET developers and separate Mac and Linux edition.

Simple interoperate, no more Excel dependency

LibXL has C/C++ headers, Delphi unit and .NET assembly for including in your project. No OLE automation.

Customizing the look and feel

LibXL supports numerous formatting options: alignments, borders, colors, fill patterns, fonts, merging cells and so on.

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 format (CPU 3.2 GHz).

Royalty-free distribution with your application

Our customers can use this library in theirs commercial applications without any fees.

Code example: generate a new spreadsheet from scratch

#include "libxl.h"

using namespace libxl;

int main()

{

Book* book = xlCreateBook();

if(book)

{

Sheet* sheet = book->addSheet(L"Sheet1");

if(sheet)

{

sheet->writeStr(2, 1, L"Hello, World !");

sheet->writeNum(3, 1, 1000);

}

book->save(Lreturn 0;

}

0818b9ca8b590ca3270a3433284dd417.png

Code example: extract data from an existing spreadsheet

Book* book = xlCreateBook();

if(book)

{

if(book->load(Lif(sheet)

{

const wchar_t* s = sheet->readStr(2, 1);

if(s) wcout << s << endl;

double d = sheet->readNum(3, 1);

cout << d << endl;

}

}

book->release();

}

0818b9ca8b590ca3270a3433284dd417.png

Code example: edit an existing spreadsheet

Book* book = xlCreateBook();

if(book)

{

if(book->load(Lif(sheet)

{

double d = sheet->readNum(3, 1);

sheet->writeNum(3, 1, d * 2);

sheet->writeStr(4, 1, L"new string");

}

book->save(L

0818b9ca8b590ca3270a3433284dd417.png

Code example: apply formatting options

Font* font = book->addFont();

font->setName(L"Impact");

font->setSize(36);

Format* format = book->addFormat();

format->setAlignH(ALIGNH_CENTER);

format->setBorder(BORDERSTYLE_MEDIUMDASHDOTDOT);

format->setBorderColor(COLOR_RED);

format->setFont(font);

Sheet* sheet = book->addSheet(L"Custom");

if(sheet)

{

sheet->writeStr(2, 1, L"Format", format);

sheet->setCol(1, 1, 25);

}

book->save(L

0818b9ca8b590ca3270a3433284dd417.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值