当前位置:网站首页>Xlslib use
Xlslib use
2022-04-23 18:52:00 【Brick Porter】
xlslib It's open source and free xls Build a library . No installation required office.
compile :
stay windows Compiling under is relatively simple , Navigate directly to the directory xlslib\build Find the corresponding VS edition , If you use the new version, you can use the upgrade of the old version . Of course, some project documents have some holes , The corresponding modification of compilation , There is also the wrong configuration , such as 2012 My directory is still 2010 The file cannot be found later . These should be carefully revised . Besides, it doesn't use itself def Nor is it defined in the header file __declspec(dllexport) Export and so on , So only generate dll It's not lib Of documents . It provides a createDLL Project , After looking at it, it seems that it is generated during project generation map file , And then through map file , Generate DEF file , Call again link.exe Generate dll and lib.
Easy to use ,lib And header files are adjusted according to the implementation location . Switching tables does not seem to support switching through table names , Of course, I tried ,excel You can't have a table name with the same name in , So build your own map To save the table name and the corresponding idx That's it . Besides dump Wide characters are not supported , Just add one by yourself , This can avoid the problem of saving Chinese file names on some foreign language systems .
# define CPP_BRIDGE_XLS
#include "..\xlslibsrc\xlslib.h"
#ifdef WIN64
#pragma comment(lib,"../lib/xlslib_dll_x64.lib")
#else
#pragma comment(lib,"../lib/xlslib_dll.lib")
#endif // X64
class CXlsLib
{
private:
// Cell
//cell_t* cell;
//font_t* _font;
//xf_t* xf;
// //pWS->defaultColwidth(25); // Set the default column width
//pWS->defaultRowHeight(30); // Set the default row height
//_font = pWB.font("Arial");
//_font->SetBoldStyle(BOLDNESS_BOLD); // Set bold font
//_font->SetHeight(220); // Set font size 11
//xf = pWB.xformat();
//xf->SetFont(_font);
//xf->SetFillBGColor(CLR_WHITE);
//xf->SetFillFGColor(CLR_RED);
// workbook
workbook m_pWB;
// Worksheet for the current operation
worksheet* m_pWS=NULL;
public:
// Get the workbooks
workbook& GetWorkBook()
{
return m_pWB;
}
// Get current worksheet
worksheet* GetCurWorksheet()
{
return m_pWS;
}
// Create a new worksheet
worksheet* CreateWorkSheet(const std::wstring& SheetName)
{
m_pWS = m_pWB.sheet(SheetName);
if (m_pWS)
{
m_pWS->MakeActive();
return m_pWS;
}
return NULL;
}
// Switch tables
worksheet* SelWordSheet(unsigned16_t SheetIdx)
{
worksheet* _pWS = m_pWB.GetSheet(SheetIdx);
if (_pWS)
{
_pWS->MakeActive();
m_pWS = _pWS;
}
return _pWS;
}
// from 0 Start
cell_t* InsData(int row, int col, const std::wstring str)
{
if (m_pWS)
return m_pWS->label(row, col, str);
return NULL;
}
// from 0 Start
cell_t* InsData(int row, int col, double num)
{
if (m_pWS)
return m_pWS->number(row, col, num);
return NULL;
}
// Save as xls file
int SaveExcelFile(const std::wstring& FileName)
{
return m_pWB.Dump(FileName);
}
};
版权声明
本文为[Brick Porter]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210603257392.html
边栏推荐
- Use of content provider
- Chondroitin sulfate in vitreous
- 使用晨曦记账本,分析某个时间段每个账户收支结余
- 实战业务优化方案总结---主目录---持续更新
- Sentinel服务熔断实战(sentinel整合ribbon+openFeign+fallback)
- ESP32 LVGL8. 1 - label (style 14)
- 12个例子夯实promise基础
- 【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
- mysql_ Download and installation of Linux version
- Go language GUI framework Fyne Chinese garbled or not displayed
猜你喜欢
【科普】CRC校验(一)什么是CRC校验?
ESP32 LVGL8. 1 - label (style 14)
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
listener.log
Halo open source project learning (VII): caching mechanism
12个例子夯实promise基础
CANopen STM32 transplantation
ctfshow-web362(SSTI)
ESP32 LVGL8. 1 - calendar (calendar 25)
【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
随机推荐
ctfshow-web362(SSTI)
Introduction to ROS learning notes (II)
Sentinel服务熔断实战(sentinel整合ribbon+openFeign+fallback)
Use of kotlin collaboration in the project
纠结
关于unity文件读取的操作(一)
Practice of Druid SQL and security in meituan review
Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
After CANopen starts PDO timing transmission, the heartbeat frame time is wrong, PDO is delayed, and CANopen time axis is disordered
Actual combat of Nacos as service configuration center
Fundamentals of machine learning theory -- some terms about machine learning
Setting up keil environment of GD single chip microcomputer
SQL中函数 decode()与 replace()的用法
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système
ESP32 LVGL8. 1 - event (event 17)
教你用简单几个步骤快速重命名文件夹名
Get a list of recent apps
Tencent map and high logo removal method
listener.log