2 Star 2 Fork 1

小灵猫/PzAssistantor_old

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
excelUtils.h 1.72 KB
一键复制 编辑 原始数据 按行查看 历史
小灵猫 提交于 2014-05-26 10:08 . 添加遗漏的文件
#ifndef EXCELUTILS_H
#define EXCELUTILS_H
#include <QtGlobal>
#ifdef Q_OS_WIN
#include <QString>
#include <QAxObject>
class BasicExcelCell{
public:
BasicExcelCell(QObject* parent = 0){};
BasicExcelCell(QAxObject* axObj, QObject* parent = 0);
int getInt();
double getDouble();
QString getString();
void Set(int val);
void Set(double val);
void Set(QString val);
private:
QAxObject* obj;
};
class BasicExcelWorksheet{
public:
BasicExcelWorksheet(QObject* parent = 0);
BasicExcelWorksheet(QAxObject* axObj, QObject* parent = 0);
void active();
BasicExcelCell* cell(int row, int col);
void mergeCells(int row, int col, ushort rowRange, ushort colRange);
private:
QString genColWord(int col);
QAxObject* obj;
};
//利用QActive模块读写Excel文件的实用类
class BasicExcel{
public:
BasicExcel(QObject* parent = 0);
void New(int sheetNum);
bool SaveAs(QString filename/*, bool isViewDlg = false*/);
bool Load(QString fname);
BasicExcelWorksheet* GetWorksheet(int sheetIndex); ///< Get a pointer to an Excel worksheet at the given index. Index starts from 0. Returns 0 if index is invalid.
BasicExcelWorksheet* GetWorksheet(QString name); ///< Get a pointer to an Excel worksheet that has given ANSI name. Returns 0 if there is no Excel worksheet with the given name.
void setVisible(bool isView);
private:
QAxObject* excel; //Excel应用程序对象
QAxObject *workbooks; //工作簿集合Workbooks对象
QAxObject *workbook; //工作簿Workbook对象
QAxObject *sheets; //工作表集合sheets对象
};
#endif //Q_OS_WIN32
#endif // EXCELUTILS_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ssc/PzAssistantor_old.git
[email protected]:ssc/PzAssistantor_old.git
ssc
PzAssistantor_old
PzAssistantor_old
master

搜索帮助