77、然后测试工程是否能正常使用库。编译运行即可。测试代码如下:#include #include #include 'xlslib.h'using namespace xlslib_core;using namespace std;//测试环境 unicode 和多字节都可以std::string ws2s(const std::wstring& ws){ std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = 'C'; setlocale(LC_ALL, 'chs'); const wchar_t* _Source = ws.c_str(); size_t _Dsize = 2 * ws.size() + 1; char *_Dest = new char[_Dsize]; memset(_Dest, 0, _Dsize); wcstombs(_Dest, _Source, _Dsize); std::string result = _Dest; delete[]_Dest; setlocale(LC_ALL, curLocale.c_str()); return result;}std::wstring s2ws(const std::string& s){ setlocale(LC_ALL, 'chs'); const char* _Source = s.c_str(); size_t _Dsize = s.size() + 1; wchar_t *_Dest = new wchar_t[_Dsize]; wmemset(_Dest, 0, _Dsize); mbstowcs(_Dest, _Source, _Dsize); std::wstring result = _Dest; delete[]_Dest; setlocale(LC_ALL, 'C'); return result;}/*indows的一些:新细明体:PMingLiU细明体:MingLiU标楷体:DFKai-SB黑体:SimHei宋体:SimSun新宋体:NSimSun仿宋:FangSong楷体:KaiTi仿宋_GB2312:FangSong_GB2312楷体_GB2312:KaiTi_GB2312微软正黑体:Microsoft JhengHei微软雅黑体:Microsoft YaHei*/int main(int argc, char *argv[]) { workbook wb;//工作薄 font_t * _font = wb.font('SimSun');//设置字体 _font->SetBoldStyle(BOLDNESS_BOLD); // 设置粗字体 xf_t* xf = wb.xformat(); xf->SetFont(_font); xf->SetFillBGColor(CLR_WHITE); xf->SetFillFGColor(CLR_RED); worksheet* ws;//sheet ws = wb.sheet('sheet1'); //ws->defaultColwidth(256 * 10);//设置行宽 //ws->colwidth(2, 256 * 30);//设置行宽 cell_t * cell; //一次操作 string label = 'Hello, World!'; cell = ws->label(1, 2, label, xf); // 从0开始数,第1行,第2列,即C3 //一次操作 string label2 = '中文测试1'; cell = ws->label(1, 3, s2ws(label2), xf); // 从0开始数,第1行,第2列,即C3 cell->fillfgcolor(CLR_RED); cell->fillbgcolor(CLR_WHITE); //range * _range; //_range = ws->rangegroup(0, 0, 1500, 100); // 设置背景为白色 //_range->cellcolor(CLR_WHITE); //_range = ws->rangegroup(1, 2, 2, 2); //_range->cellcolor(CLR_GOLD); wb.Dump('test.xls'); return 0;}