資源簡介
C++操作excel,將數據保存到excel中.
已封裝成dll,調用dll可以實現對excel的操作保存數據
其中給了調用dll的例子以及說明文檔
已經實現的函數功能:
SetSheetNum(USHORT newVal) 設置工作薄個數
SetCurrentSheet(USHORT newVal) 設置當前工作薄
SetFontWeight(int newVal) 設置字體粗細
SetCellFormat(const wchar_t* newVal) 設置單元格數字顯示格式
SetMergedColumns(int row, int col, USHORT nColNum) 設置單元格合并列,從第row行第col列開始合并nColNum列
SetMergedRows(int row, int col, USHORT nRowNum) 設置單元格合并行,從第row行第col列開始合并nRowNum行
SetAlignment(BYTE nAlignment) 設置單元格對齊方式
SetColWidth(const int nColIndex, USHORT nWidth) 設置列寬
SetFontHeight(int nHeight) 設置字體高度
SetFontColor(BOOL bTrue, int nColor) 設置字體顏色
SetBackgroundColor(BOOL bTrue, int nColor) 設置背景色
WriteExcelW(const wchar_t* svConext, int row, int col) 寫入數據主要實現漢字輸入
WriteExcelA(const char* svConext, int row, int col) 寫入數據主要實現英文輸入
WriteExceldouble(double fVal, int row, int col) 寫入數據主要實現小數輸入
WriteExcelint(int nVal, int row, int col) 寫入數據主要實現整數輸入
SaveExcel(const char* newVal) 保存數據

代碼片段和文件信息
//?RegularDllCall.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“RegularDllCall.h“
#include?“RegularDllCallDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CRegularDllCallApp
BEGIN_MESSAGE_MAP(CRegularDllCallApp?CWinApp)
//{{AFX_MSG_MAP(CRegularDllCallApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CRegularDllCallApp?construction
CRegularDllCallApp::CRegularDllCallApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CRegularDllCallApp?object
CRegularDllCallApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CRegularDllCallApp?initialization
BOOL?CRegularDllCallApp::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
CRegularDllCallDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????528448??2011-07-06?16:06??RegularDllCall\MyExceldll.dll
?????文件??????17920??2011-07-06?17:18??RegularDllCall\MyExceldll使用說明.xls
?????文件???????3723??2005-09-20?17:15??RegularDllCall\ReadMe.txt
?????文件??????20140??2011-07-01?15:23??RegularDllCall\RegularDllCall.aps
?????文件????????851??2011-07-06?17:18??RegularDllCall\RegularDllCall.clw
?????文件???????2002??2005-09-20?17:15??RegularDllCall\RegularDllCall.cpp
?????文件???????4304??2011-07-01?11:15??RegularDllCall\RegularDllCall.dsp
?????文件????????553??2005-09-20?17:15??RegularDllCall\RegularDllCall.dsw
?????文件??????20480??2011-07-06?17:18??RegularDllCall\RegularDllCall.exe
?????文件???????1412??2005-09-20?17:15??RegularDllCall\RegularDllCall.h
?????文件?????197632??2011-07-06?17:19??RegularDllCall\RegularDllCall.ncb
?????文件??????55808??2011-07-06?17:19??RegularDllCall\RegularDllCall.opt
?????文件???????1685??2011-07-06?17:18??RegularDllCall\RegularDllCall.plg
?????文件???????4577??2005-09-20?17:42??RegularDllCall\RegularDllCall.rc
?????文件???????7910??2011-07-06?16:08??RegularDllCall\RegularDllCallDlg.cpp
?????文件???????1410??2005-09-20?17:42??RegularDllCall\RegularDllCallDlg.h
?????文件???????1078??2005-09-20?17:15??RegularDllCall\res\RegularDllCall.ico
?????文件????????406??2005-09-20?17:15??RegularDllCall\res\RegularDllCall.rc2
?????文件????????554??2005-09-20?17:42??RegularDllCall\Resource.h
?????文件????????216??2005-09-20?17:15??RegularDllCall\StdAfx.cpp
?????文件???????2342??2011-07-06?16:31??RegularDllCall\StdAfx.h
?????文件???????6144??2011-07-06?17:18??RegularDllCall\wh.xls
?????目錄??????????0??2011-07-01?15:16??RegularDllCall\res
?????目錄??????????0??2011-07-06?17:19??RegularDllCall
-----------?---------??----------?-----??----
???????????????879595????????????????????24
評論
共有 條評論