91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-05
  • 語言: 其他
  • 標簽: QT??個稅??計算器??

資源簡介

可導入excel表格的用QT開發(fā)的個稅計算器,可針對不同稅率在代碼中進行修改

資源截圖

代碼片段和文件信息

#include?“excelengine.h“
#include?“qt_windows.h“

ExcelEngine::ExcelEngine()
{
????pExcel?????=?NULL;
????pWorkbooks?=?NULL;
????pWorkbook??=?NULL;
????pWorksheet?=?NULL;

????sXlsFile?????=?““;
????nRowCount????=?0;
????nColumnCount?=?0;
????nStartRow????=?0;
????nStartColumn?=?0;

????bIsOpen??=?false;
????bIsValid?=?false;

????HRESULT?r?=?OleInitialize(0);
????if?(r?!=?S_OK?&&?r?!=?S_FALSE)
????{
????????qDebug(“Qt:?Could?not?initialize?OLE?(error?%x)“?(unsigned?int)r);
????}
}

ExcelEngine::ExcelEngine(QString?xlsFile)
{
????pExcel?????=?NULL;
????pWorkbooks?=?NULL;
????pWorkbook??=?NULL;
????pWorksheet?=?NULL;

????sXlsFile?????=?xlsFile;
????nRowCount????=?0;
????nColumnCount?=?0;
????nStartRow????=?0;
????nStartColumn?=?0;

????bIsOpen??=?false;
????bIsValid?=?false;

????HRESULT?r?=?OleInitialize(0);
????if?(r?!=?S_OK?&&?r?!=?S_FALSE)
????{
????????qDebug(“Qt:?Could?not?initialize?OLE?(error?%x)“?(unsigned?int)r);
????}
}

ExcelEngine::~ExcelEngine()
{
????if?(?bIsOpen?)
????{
????????//析構前,先保存數(shù)據(jù),然后關閉workbook
????????Close();
????}
????OleUninitialize();
}

/**
??*@brief?打開sXlsFile指定的excel報表
??*@return?true?:?打開成功
??*????????false:?打開失敗
??*/
bool?ExcelEngine::Open(UINT?nSheet?bool?visible)
{

????if?(?bIsOpen?)
????{
????????//return?bIsOpen;
????????Close();
????}

????if?(?NULL?==?pExcel?)
????{
????????pExcel?=?new?QAxobject(“Excel.Application“);
????????if?(?pExcel?)
????????{
????????????bIsValid?=?true;
????????}
????????else
????????{
????????????bIsValid?=?false;
????????????bIsOpen??=?false;
????????????return?bIsOpen;
????????}

????????pExcel->dynamicCall(“SetVisible(bool)“?bIsVisible);
????}

????if?(?!bIsValid?)
????{
????????bIsOpen??=?false;
????????return?bIsOpen;
????}

????if?(?sXlsFile.isEmpty()?)
????{
????????bIsOpen??=?false;
????????return?bIsOpen;
????}


????bool?ok?=?CreateXlsFile(sXlsFile);
????if?(?!ok?)
????{
????????bIsOpen??=?false;
????????return?bIsOpen;
????}

????nCurrSheet?=?nSheet;
????bIsVisible?=?visible;

????pWorkbooks?=?pExcel->querySubobject(“WorkBooks“);?//獲取工作簿
????pWorkbook?=?pWorkbooks->querySubobject(“Open(QString?QVariant)“sXlsFileQVariant(0));?//打開xls對應的工作簿
????pWorksheet?=?pWorkbook->querySubobject(“WorkSheets(int)“?nCurrSheet);//打開第一個sheet

????//至此已打開,開始獲取相應屬性
????QAxobject?*usedrange?=?pWorksheet->querySubobject(“UsedRange“);//獲取該sheet的使用范圍對象
????QAxobject?*rows?=?usedrange->querySubobject(“Rows“);
????QAxobject?*columns?=?usedrange->querySubobject(“Columns“);

????//因為excel可以從任意行列填數(shù)據(jù)而不一定是從00開始,因此要獲取首行列下標
????nStartRow????=?usedrange->property(“Row“).toInt();????//第一行的起始位置
????nStartColumn?=?usedrange->property(“Column“).toInt();?//第一列的起始位置

????nRowCount????=?rows->property(“Count“).toInt();???????//獲取行數(shù)
????nColumnCount?=?columns->property(“Count“).toInt();????//獲取列數(shù)

????bIsOpen??=?true;
????return?bIsOpen;
}

/**
??*@brief?Open()的重載函數(shù)
??*/

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????9412??2012-06-02?19:35??tax\excelengine.cpp

?????文件???????2210??2012-05-22?20:31??tax\excelengine.h

?????文件????????270??2012-10-08?09:58??tax\main.cpp

?????文件??????10707??2012-10-23?20:10??tax\mainwindow.cpp

?????文件????????478??2012-10-08?11:49??tax\mainwindow.h

?????文件???????4700??2012-10-23?22:16??tax\mainwindow.ui

?????文件????????394??2012-10-07?15:18??tax\tax.pro

?????文件??????17608??2012-10-23?23:03??tax\tax.pro.user

?????文件??????29759??2012-10-23?22:42??tax\tax.pro.user.2.5pre1

?????目錄??????????0??2013-01-05?08:35??tax

-----------?---------??----------?-----??----

????????????????75538????????????????????10


評論

共有 條評論