欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
libxl-3.1.0下載 可操作excel,不依賴excel安裝環境
[打印本頁]
作者:
wangfans
時間:
2017-9-1 12:22
標題:
libxl-3.1.0下載 可操作excel,不依賴excel安裝環境
我們常用ole方式操作excel,需要安裝excel,并且如果訪問越界會runtime error。
采用libxl操作excel,不依賴excel安裝環境。直接讀取excel,并且不會出現runtime error。非常方便。
0.png
(41.9 KB, 下載次數: 68)
下載附件
2017-9-1 15:43 上傳
所有資料51hei提供下載:
libxl-3.1(破解版).rar
(3.27 MB, 下載次數: 15)
2017-9-1 12:22 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
源程序如下:
#include <iostream>
#include <libxl.h>
#include <Windows.h>
using namespace std;
using namespace libxl;
//中文的內容讀出來后要進行編碼的轉換,這個為轉換函數:wchar_t to char
char *w2c(char *pcstr,const wchar_t *pwstr, size_t len)
{
int nlength=wcslen(pwstr);
//獲取轉換后的長度
int nbytes = WideCharToMultiByte( 0, 0, pwstr, nlength, NULL,0,NULL, NULL );
if(nbytes>len) nbytes=len;
// 通過以上得到的結果,轉換unicode 字符為ascii 字符
WideCharToMultiByte( 0,0, pwstr, nlength, pcstr, nbytes, NULL, NULL );
return pcstr ;
}
int main(int argc, char* argv[])
{
Book* book = xlCreateXMLBook();
if(book->load(L"1.xlsx")){
Sheet * sheet = book->getSheet(0);
if(sheet){
CellType celltype = sheet->cellType(1,1);
cout<<"the type is:"<<celltype<<endl;
const wchar_t * t = sheet->readStr(1,1);
char *pcstr = (char *)malloc(sizeof(char)*(2 * wcslen(t)+1));
memset(pcstr , 0 , 2 * wcslen(t)+1 );
w2c(pcstr,t,2 * wcslen(t)+1) ;
cout<<"result:"<<pcstr<<endl;
free(pcstr);
}
}
system("pause");
return 0;
}
復制代碼
作者:
xinqinglhj
時間:
2017-9-13 10:53
沒有用過不知道好不好用。
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1