首页| 论坛| 消息
主题:自用的Excel访问操作类
回帖:更详细用法说明稍后补充,预留
void selectSheet(const QString& sheetName);//选择WorkSheet
//sheetIndex 起始于 1
void selectSheet(int sheetIndex); //选择WorkSheet
void deleteSheet(const QString& sheetName); //删除WorkSheet
void deleteSheet(int sheetIndex); //删除WorkSheet
void insertSheet(QString sheetName); //插入WorkSheet
int getSheetsCount();//获取WorkSheet总数
//在 selectSheet() 之后才可调用
QString getSheetName(); //获取选中的Sheet名称
QString getSheetName(int sheetIndex); //获取某个Index的WorkSheet名称
/**************************************************************************/
/* 单元格 */
/**************************************************************************/
void setCellString(int row, int column, const QString& value);//设置某单元格文本
//cell 例如 "A7"
void setCellString(const QString& cell, const QString& value);//设置某单元格文本
//range 例如 "A5:C7"
void mergeCells(const QString& range);//合并单元格,如mergeCells(“A5:C7”)
void mergeCells(int topLeftRow, int topLeftColumn, int bottomRightRow, int bottomRightColumn); //合并单元格
QVariant getCellValue(int row, int column) const; //获取单元格内容
void clearCell(int row, int column);//清除单元格内容
void clearCell(const QString& cell);//清除单元格内容
/**************************************************************************/
/* 布局格式 */
/**************************************************************************/
void getUsedRange(int *topLeftRow, int *topLeftColumn, int *bottomRightRow, int *bottomRightColumn);//获取使用范围,四个参数均为返回值,以后改为引用传出
void setColumnWidth(int column, int width);//设置列宽
void setColumnWidth(QString column, int width);//设置列宽
void setRowHeight(int row, int height);
void setCellTextCenter(int row, int column);
void setCellTextCenter(const QString& cell);
void setCellTextWrap(int row, int column, bool isWrap);
void setCellTextWrap(const QString& cell, bool isWrap);
void setAutoFitRow(int row);
void setAutoFitColumn(int column);
void mergeSerialSameCellsInAColumn(int column, int topRow);
int getUsedRowsCount();
void setCellFontBold(int row, int column, bool isBold);
void setCellFontBold(const QString& cell, bool isBold);
void setCellFontSize(int row, int column, int size);
void setCellFontSize(const QString& cell, int size);
/**************************************************************************/
/* 文件 */
/**************************************************************************/
void save();
void close();
//===================added by wdg========================
QAxObject * getRange(const QString &strCell1, const QString &strCell2 = "" );
QAxObject * getRange(int minRow, int minCol, int maxRow=0, int maxCol=0);
void setRangeFont(int minRow, int minCol, int maxRow, int maxCol, T_RangeFont * pFont);
void setRangeWrap(int minRow, int minCol, int maxRow, int maxCol, bool bWrap = true);
QString getCellText(int iRow, int iCol) const;
void setRangeAlignment(int minRow, int minCol, int maxRow, int maxCol, T_Alignment * pAlignment);
void setRangeBkColor(int minRow, int minCol, int maxRow, int maxCol, const QColor &colorRef);
void setRangeBorder(int minRow, int minCol, int maxRow, int maxCol, T_RangeBorder * pRangeBorder =NULL );
void drawGrid(int iminRow, int iminCol, int imaxRow, int imaxCol, T_RangeBorder * pRangeBorder = NULL );
void showExcelApp(bool b);
void setRangeFormat(int minRow, int minCol, int maxRow, int maxCol, const QString strFmt);
下一页 (1/2)
下一楼›:好牛啊,能否可以贴图。

查看全部回帖(24)
«返回主帖