国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

天津企業(yè)網(wǎng)站設(shè)計(jì)報(bào)價(jià)搜索引擎技術(shù)

天津企業(yè)網(wǎng)站設(shè)計(jì)報(bào)價(jià),搜索引擎技術(shù),邊個(gè)網(wǎng)站可以接模具做,衛(wèi)計(jì)網(wǎng)站建設(shè)工作總結(jié)原版xlslib輸出UTF8漢字有誤,我在網(wǎng)上找到這個(gè)古老的帖子修改開源xlslib使得支持輸出UTF8中文Excel文件內(nèi)容不亂碼, 它自定義了2個(gè)指定UTF8編碼的重載label()函數(shù)。 照做后,第一步發(fā)現(xiàn)編譯有錯(cuò) In file included from ./xlslib.h:53,from xlslib/cbridg…

原版xlslib輸出UTF8漢字有誤,我在網(wǎng)上找到這個(gè)古老的帖子修改開源xlslib使得支持輸出UTF8中文Excel文件內(nèi)容不亂碼, 它自定義了2個(gè)指定UTF8編碼的重載label()函數(shù)。
照做后,第一步發(fā)現(xiàn)編譯有錯(cuò)

In file included from ./xlslib.h:53,from xlslib/cbridge.cpp:50:
./xlslib/sheetrec.h:339:72: error: 'ustring' in namespace 'std' does not name a type; did you mean 'wstring'?339 | cell_t* label(int code, unsigned16_t row, unsigned16_t col, const std::ustring& strlabel, xf_t* pxformat = NULL);|                                                                        ^~~~~~~|                                                                        wstring

觀察同一個(gè)函數(shù)的其他重載聲明,ustring命名空間不是std而是xlslib_strings,照著改成如下聲明后,make通過(guò)。在xlslib/xlslib/src/.libs中生成了新的動(dòng)態(tài)鏈接庫(kù)文件。

		cell_t* label(unsigned32_t row, unsigned32_t col,const xlslib_strings::ustring& strlabel, xf_t* pxformat = NULL);
/*
* 在xlslib/src/sheetrec.h中增加如下代碼
*/
cell_t* label(int code, unsigned16_t row, unsigned16_t col, const xlslib_strings::ustring& strlabel, xf_t* pxformat = NULL);

直接用ws->label(UTF8,0, col, "Col_中文");輸出的仍是亂碼。需要在字符串前加L修飾符,指定它是寬字符串才能輸出漢字,但L"Col_漢字" + std::to_string(col)編譯又會(huì)報(bào)錯(cuò)。

在https://www.runoob.com/cplusplus/cpp-libs-codecvt.html 教程網(wǎng)站上找到了std::wstring_convert轉(zhuǎn)換器,寫成如下就能正確輸出UTF8漢字和數(shù)字混合字符串了。

        // 寫入標(biāo)題enum { UTF8, GBK };for (int col = 0; col < cols; ++col) {//ws->label(UTF8,0, col, L"Col_中文");std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;// 原始的 UTF-8 字符串//std::string narrow_string = "Hello, World!";// 轉(zhuǎn)換為 UTF-16 寬字符串//std::wstring wide_string = converter.from_bytes(narrow_string);std::wstring wide_string = converter.from_bytes(("Col_漢字" + std::to_string(col)).c_str());ws->label(UTF8,0, col, wide_string);}

為防止原帖不可訪問(wèn)。將它的改寫代碼抄錄如下,命名空間已修改

/*
* 在xlslib/src/sheetrec.h中增加如下代碼
*/
cell_t* label(int code, unsigned16_t row, unsigned16_t col, const xlslib_strings::ustring& strlabel, xf_t* pxformat = NULL);
cell_t* label(int code, unsigned16_t row, unsigned16_t col, const char* strlabel, xf_t* pxformat = NULL);/*
* 在xlslib/src/sheetrec.cpp中增加如下代碼
*/
cell_t* worksheet::label(int code, unsigned16_t row, unsigned16_t col,const ustring& strlabel, xf_t* pxformat)
{enum { UTF8, GBK };u16string str16;label_t* lbl;u16string::const_iterator u16begin, u16end;ustring::const_iterator ubegin, uend;size_t len;if (code == UTF8) {len = strlabel.length();str16.reserve(len);ubegin = strlabel.begin();uend = strlabel.end();while(ubegin != uend) {unichar_t c;c = *ubegin++;str16.push_back(c);       }lbl = new label_t(m_GlobalRecords, row, col, str16, pxformat);AddCell((cell_t*)lbl);return (cell_t*)lbl;} else {return NULL;}
}
cell_t* worksheet::label(int code, unsigned16_t row, unsigned16_t col,const char* strlabel, xf_t* pxformat)
{enum { UTF8, GBK };unsigned16_t u16;u16string str16;label_t* lbl;wstring::const_iterator wbegin, wend;size_t len;if (code == UTF8) {if (strlabel == NULL) {return NULL;} else {len = strlen(strlabel);wchar_t wcs[len+1];mbstowcs(wcs, strlabel, len+1);len = wcslen(wcs);for (int i = 0; i < len; i++) {u16 = wcs[i];str16.push_back(u16);}}lbl = new label_t(m_GlobalRecords, row, col, str16, pxformat);AddCell((cell_t*)lbl);return (cell_t*)lbl;} else {return NULL;}
}
http://m.aloenet.com.cn/news/39867.html

相關(guān)文章:

  • 做招聘網(wǎng)站賺錢么百度知道推廣軟件
  • 上饒做網(wǎng)站網(wǎng)站備案流程
  • 網(wǎng)站備案號(hào)位置免費(fèi)關(guān)鍵詞優(yōu)化工具
  • 網(wǎng)站開發(fā)實(shí)驗(yàn)報(bào)告可行性分析簡(jiǎn)單網(wǎng)站建設(shè)優(yōu)化推廣
  • asp 做購(gòu)物網(wǎng)站成都全網(wǎng)營(yíng)銷推廣
  • 模板商城建站網(wǎng)絡(luò)營(yíng)銷的概念
  • 個(gè)人網(wǎng)站開發(fā)永久免費(fèi)google搜索引擎
  • 延邊州建設(shè)局網(wǎng)站上海平臺(tái)推廣的公司
  • 用什么軟件做網(wǎng)站布局seo優(yōu)化主要做什么
  • 做網(wǎng)站 售后服務(wù)里都寫啥商丘網(wǎng)站seo
  • 無(wú)錫網(wǎng)站設(shè)計(jì)哪里靠譜大數(shù)據(jù)營(yíng)銷平臺(tái)那么多
  • 025網(wǎng)站建設(shè)電工培訓(xùn)機(jī)構(gòu)
  • 網(wǎng)站部署到終端機(jī)怎么做旅游產(chǎn)品推廣有哪些渠道
  • 淘寶做短視頻網(wǎng)站百度第三季度財(cái)報(bào)2022
  • 南充 網(wǎng)站開發(fā)蘇州關(guān)鍵詞優(yōu)化怎樣
  • 傳媒網(wǎng)站建設(shè)網(wǎng)站推廣排名服務(wù)
  • wordpress 3306優(yōu)化工具箱下載
  • 做網(wǎng)站是做廣告嗎網(wǎng)站流量數(shù)據(jù)
  • 世界杯網(wǎng)站開發(fā)長(zhǎng)春網(wǎng)站建設(shè)設(shè)計(jì)
  • 網(wǎng)站制作ppt抖音怎么推廣
  • 護(hù)膚品網(wǎng)站建設(shè)分析網(wǎng)頁(yè)制作工具有哪些
  • 武漢網(wǎng)站建設(shè)前十杭州seo代理公司
  • wordpress文章加密搜索不到優(yōu)化排名工具
  • 做網(wǎng)站如何分類產(chǎn)品百度seo排名優(yōu)化教程
  • 搜索網(wǎng)站排名軟件公司開發(fā)設(shè)計(jì)推薦
  • 做圖標(biāo)去什么網(wǎng)站找最新實(shí)時(shí)新聞
  • c 網(wǎng)站開發(fā)技術(shù)整合營(yíng)銷什么意思
  • 公司網(wǎng)頁(yè)設(shè)計(jì)費(fèi)計(jì)入什么科目網(wǎng)站建設(shè)優(yōu)化公司
  • phpcms套好的網(wǎng)站 放到空間上 后臺(tái)打開的驗(yàn)證碼不能顯示關(guān)鍵詞排名優(yōu)化怎么樣
  • flask做網(wǎng)站惡意點(diǎn)擊軟件哪個(gè)好