1、C+操作 Excel 所需要的 Excel.h,与 Excel.cpp 文件介绍:这两个文件使用 C+ 6.0 导出的,并且在 Visual Studio 2005/2008 下测试通过/*/头文件 Excel.h/ Machine generated IDispatch wrapper class(es) created with ClassWizard/ _Application wrapper classclass _Application : public COleDispatchDriverpublic:_Application() / Calls COleDispatchDrive
2、r default constructor_Application(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) _Application(const _Applicationlong GetCreator();LPDISPATCH GetParent();LPDISPATCH GetActiveCell();LPDISPATCH GetActiveChart();CString GetActivePrinter();void SetActivePrinter(LPCTSTR lpszNewValue);LPDISPATCH Get
3、ActiveSheet();LPDISPATCH GetActiveWindow();LPDISPATCH GetActiveWorkbook();LPDISPATCH GetAddIns();LPDISPATCH GetAssistant();void Calculate();LPDISPATCH GetCells();LPDISPATCH GetCharts();LPDISPATCH GetColumns();LPDISPATCH GetCommandBars();long GetDDEAppReturnCode();void DDEExecute(long Channel, LPCTST
4、R String);long DDEInitiate(LPCTSTR App, LPCTSTR Topic);void DDEPoke(long Channel, const VARIANTVARIANT DDERequest(long Channel, LPCTSTR Item);void DDETerminate(long Channel);VARIANT Evaluate(const VARIANTVARIANT _Evaluate(const VARIANTVARIANT ExecuteExcel4Macro(LPCTSTR String);LPDISPATCH Intersect(L
5、PDISPATCH Arg1, LPDISPATCH Arg2, const VARIANTLPDISPATCH GetNames();LPDISPATCH GetRange(const VARIANTLPDISPATCH GetRows();VARIANT Run(const VARIANTVARIANT _Run2(const VARIANTLPDISPATCH GetSelection();void SendKeys(const VARIANTLPDISPATCH GetSheets();LPDISPATCH GetThisWorkbook();LPDISPATCH Union(LPDI
6、SPATCH Arg1, LPDISPATCH Arg2, const VARIANTLPDISPATCH GetWindows();LPDISPATCH GetWorkbooks();LPDISPATCH GetWorksheetFunction();LPDISPATCH GetWorksheets();LPDISPATCH GetExcel4IntlMacroSheets();LPDISPATCH GetExcel4MacroSheets();void ActivateMicrosoftApp(long Index);void AddChartAutoFormat(const VARIAN
7、Tvoid AddCustomList(const VARIANTBOOL GetAlertBeforeOverwriting();void SetAlertBeforeOverwriting(BOOL bNewValue);CString GetAltStartupPath();void SetAltStartupPath(LPCTSTR lpszNewValue);BOOL GetAskToUpdateLinks();void SetAskToUpdateLinks(BOOL bNewValue);BOOL GetEnableAnimations();void SetEnableAnima
8、tions(BOOL bNewValue);LPDISPATCH GetAutoCorrect();long GetBuild();BOOL GetCalculateBeforeSave();void SetCalculateBeforeSave(BOOL bNewValue);long GetCalculation();void SetCalculation(long nNewValue);VARIANT GetCaller(const VARIANTBOOL GetCanPlaySounds();BOOL GetCanRecordSounds();CString GetCaption();
9、void SetCaption(LPCTSTR lpszNewValue);BOOL GetCellDragAndDrop();void SetCellDragAndDrop(BOOL bNewValue);double CentimetersToPoints(double Centimeters);BOOL CheckSpelling(LPCTSTR Word, const VARIANTVARIANT GetClipboardFormats(const VARIANTBOOL GetDisplayClipboardWindow();void SetDisplayClipboardWindo
10、w(BOOL bNewValue);long GetCommandUnderlines();void SetCommandUnderlines(long nNewValue);BOOL GetConstrainNumeric();void SetConstrainNumeric(BOOL bNewValue);VARIANT ConvertFormula(const VARIANTBOOL GetCopyObjectsWithCells();void SetCopyObjectsWithCells(BOOL bNewValue);long GetCursor();void SetCursor(
11、long nNewValue);long GetCustomListCount();long GetCutCopyMode();void SetCutCopyMode(long nNewValue);long GetDataEntryMode();void SetDataEntryMode(long nNewValue);CString Get_Default();CString GetDefaultFilePath();void SetDefaultFilePath(LPCTSTR lpszNewValue);void DeleteChartAutoFormat(LPCTSTR Name);
12、void DeleteCustomList(long ListNum);LPDISPATCH GetDialogs();BOOL GetDisplayAlerts();void SetDisplayAlerts(BOOL bNewValue);BOOL GetDisplayFormulaBar();void SetDisplayFormulaBar(BOOL bNewValue);BOOL GetDisplayFullScreen();void SetDisplayFullScreen(BOOL bNewValue);BOOL GetDisplayNoteIndicator();void Se
13、tDisplayNoteIndicator(BOOL bNewValue);long GetDisplayCommentIndicator();void SetDisplayCommentIndicator(long nNewValue);BOOL GetDisplayExcel4Menus();void SetDisplayExcel4Menus(BOOL bNewValue);BOOL GetDisplayRecentFiles();void SetDisplayRecentFiles(BOOL bNewValue);BOOL GetDisplayScrollBars();void Set
14、DisplayScrollBars(BOOL bNewValue);BOOL GetDisplayStatusBar();void SetDisplayStatusBar(BOOL bNewValue);void DoubleClick();BOOL GetEditDirectlyInCell();void SetEditDirectlyInCell(BOOL bNewValue);BOOL GetEnableAutoComplete();void SetEnableAutoComplete(BOOL bNewValue);long GetEnableCancelKey();void SetE
15、nableCancelKey(long nNewValue);BOOL GetEnableSound();void SetEnableSound(BOOL bNewValue);VARIANT GetFileConverters(const VARIANTLPDISPATCH GetFileSearch();LPDISPATCH GetFileFind();BOOL GetFixedDecimal();void SetFixedDecimal(BOOL bNewValue);long GetFixedDecimalPlaces();void SetFixedDecimalPlaces(long
16、 nNewValue);VARIANT GetCustomListContents(long ListNum);long GetCustomListNum(const VARIANTVARIANT GetOpenFilename(const VARIANTVARIANT GetSaveAsFilename(const VARIANTvoid Goto(const VARIANTdouble GetHeight();void SetHeight(double newValue);void Help(const VARIANTBOOL GetIgnoreRemoteRequests();void
17、SetIgnoreRemoteRequests(BOOL bNewValue);double InchesToPoints(double Inches);VARIANT InputBox(LPCTSTR Prompt, const VARIANTBOOL GetInteractive();void SetInteractive(BOOL bNewValue);VARIANT GetInternational(const VARIANTBOOL GetIteration();void SetIteration(BOOL bNewValue);double GetLeft();void SetLe
18、ft(double newValue);CString GetLibraryPath();void MacroOptions(const VARIANTvoid MailLogoff();void MailLogon(const VARIANTVARIANT GetMailSession();long GetMailSystem();BOOL GetMathCoprocessorAvailable();double GetMaxChange();void SetMaxChange(double newValue);long GetMaxIterations();void SetMaxItera
19、tions(long nNewValue);BOOL GetMouseAvailable();BOOL GetMoveAfterReturn();void SetMoveAfterReturn(BOOL bNewValue);long GetMoveAfterReturnDirection();void SetMoveAfterReturnDirection(long nNewValue);LPDISPATCH GetRecentFiles();CString GetName();LPDISPATCH NextLetter();CString GetNetworkTemplatesPath()
20、;LPDISPATCH GetODBCErrors();long GetODBCTimeout();void SetODBCTimeout(long nNewValue);void OnKey(LPCTSTR Key, const VARIANTvoid OnRepeat(LPCTSTR Text, LPCTSTR Procedure);void OnTime(const VARIANTvoid OnUndo(LPCTSTR Text, LPCTSTR Procedure);CString GetOnWindow();void SetOnWindow(LPCTSTR lpszNewValue)
21、;CString GetOperatingSystem();CString GetOrganizationName();CString GetPath();CString GetPathSeparator();VARIANT GetPreviousSelections(const VARIANTBOOL GetPivotTableSelection();void SetPivotTableSelection(BOOL bNewValue);BOOL GetPromptForSummaryInfo();void SetPromptForSummaryInfo(BOOL bNewValue);vo
22、id Quit();void RecordMacro(const VARIANTBOOL GetRecordRelative();long GetReferenceStyle();void SetReferenceStyle(long nNewValue);VARIANT GetRegisteredFunctions(const VARIANTBOOL RegisterXLL(LPCTSTR Filename);void Repeat();BOOL GetRollZoom();void SetRollZoom(BOOL bNewValue);void SaveWorkspace(const V
23、ARIANTBOOL GetScreenUpdating();void SetScreenUpdating(BOOL bNewValue);void SetDefaultChart(const VARIANTlong GetSheetsInNewWorkbook();void SetSheetsInNewWorkbook(long nNewValue);BOOL GetShowChartTipNames();void SetShowChartTipNames(BOOL bNewValue);BOOL GetShowChartTipValues();void SetShowChartTipVal
24、ues(BOOL bNewValue);CString GetStandardFont();void SetStandardFont(LPCTSTR lpszNewValue);double GetStandardFontSize();void SetStandardFontSize(double newValue);CString GetStartupPath();VARIANT GetStatusBar();void SetStatusBar(const VARIANTCString GetTemplatesPath();BOOL GetShowToolTips();void SetSho
25、wToolTips(BOOL bNewValue);double GetTop();void SetTop(double newValue);long GetDefaultSaveFormat();void SetDefaultSaveFormat(long nNewValue);CString GetTransitionMenuKey();void SetTransitionMenuKey(LPCTSTR lpszNewValue);long GetTransitionMenuKeyAction();void SetTransitionMenuKeyAction(long nNewValue
26、);BOOL GetTransitionNavigKeys();void SetTransitionNavigKeys(BOOL bNewValue);void Undo();double GetUsableHeight();double GetUsableWidth();BOOL GetUserControl();void SetUserControl(BOOL bNewValue);CString GetUserName_();void SetUserName(LPCTSTR lpszNewValue);CString GetValue();LPDISPATCH GetVbe();CStr
27、ing GetVersion();BOOL GetVisible();void SetVisible(BOOL bNewValue);void Volatile(const VARIANTdouble GetWidth();void SetWidth(double newValue);BOOL GetWindowsForPens();long GetWindowState();void SetWindowState(long nNewValue);long GetDefaultSheetDirection();void SetDefaultSheetDirection(long nNewVal
28、ue);long GetCursorMovement();void SetCursorMovement(long nNewValue);BOOL GetControlCharacters();void SetControlCharacters(BOOL bNewValue);BOOL GetEnableEvents();void SetEnableEvents(BOOL bNewValue);BOOL Wait(const VARIANTBOOL GetExtendList();void SetExtendList(BOOL bNewValue);LPDISPATCH GetOLEDBErro
29、rs();CString GetPhonetic(const VARIANTLPDISPATCH GetCOMAddIns();LPDISPATCH GetDefaultWebOptions();CString GetProductCode();CString GetUserLibraryPath();BOOL GetAutoPercentEntry();void SetAutoPercentEntry(BOOL bNewValue);LPDISPATCH GetLanguageSettings();LPDISPATCH GetAnswerWizard();void CalculateFull
30、();BOOL FindFile();long GetCalculationVersion();BOOL GetShowWindowsInTaskbar();void SetShowWindowsInTaskbar(BOOL bNewValue);long GetFeatureInstall();void SetFeatureInstall(long nNewValue);BOOL GetReady();LPDISPATCH GetFindFormat();void SetRefFindFormat(LPDISPATCH newValue);LPDISPATCH GetReplaceForma
31、t();void SetRefReplaceFormat(LPDISPATCH newValue);LPDISPATCH GetUsedObjects();long GetCalculationState();long GetCalculationInterruptKey();void SetCalculationInterruptKey(long nNewValue);LPDISPATCH GetWatches();BOOL GetDisplayFunctionToolTips();void SetDisplayFunctionToolTips(BOOL bNewValue);long Ge
32、tAutomationSecurity();void SetAutomationSecurity(long nNewValue);LPDISPATCH GetFileDialog(long fileDialogType);void CalculateFullRebuild();BOOL GetDisplayPasteOptions();void SetDisplayPasteOptions(BOOL bNewValue);BOOL GetDisplayInsertOptions();void SetDisplayInsertOptions(BOOL bNewValue);BOOL GetGen
33、erateGetPivotData();void SetGenerateGetPivotData(BOOL bNewValue);LPDISPATCH GetAutoRecover();long GetHwnd();long GetHinstance();void CheckAbort(const VARIANTLPDISPATCH GetErrorCheckingOptions();BOOL GetAutoFormatAsYouTypeReplaceHyperlinks();void SetAutoFormatAsYouTypeReplaceHyperlinks(BOOL bNewValue
34、);LPDISPATCH GetSmartTagRecognizers();LPDISPATCH GetNewWorkbook();LPDISPATCH GetSpellingOptions();LPDISPATCH GetSpeech();BOOL GetMapPaperSize();void SetMapPaperSize(BOOL bNewValue);BOOL GetShowStartupDialog();void SetShowStartupDialog(BOOL bNewValue);CString GetDecimalSeparator();void SetDecimalSepa
35、rator(LPCTSTR lpszNewValue);CString GetThousandsSeparator();void SetThousandsSeparator(LPCTSTR lpszNewValue);BOOL GetUseSystemSeparators();void SetUseSystemSeparators(BOOL bNewValue);LPDISPATCH GetThisCell();LPDISPATCH GetRtd();BOOL GetDisplayDocumentActionTaskPane();void SetDisplayDocumentActionTas
36、kPane(BOOL bNewValue);void DisplayXMLSourcePane(const VARIANTBOOL GetArbitraryXMLSupportAvailable();/ _Worksheet wrapper classclass _Worksheet : public COleDispatchDriverpublic:_Worksheet() / Calls COleDispatchDriver default constructor_Worksheet(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch)
37、 _Worksheet(const _Worksheetlong GetCreator();LPDISPATCH GetParent();void Activate();void Copy(const VARIANTvoid Delete();CString GetCodeName();CString Get_CodeName();void Set_CodeName(LPCTSTR lpszNewValue);long GetIndex();void Move(const VARIANTCString GetName();void SetName(LPCTSTR lpszNewValue);L
38、PDISPATCH GetNext();LPDISPATCH GetPageSetup();LPDISPATCH GetPrevious();void PrintPreview(const VARIANTBOOL GetProtectContents();BOOL GetProtectDrawingObjects();BOOL GetProtectionMode();BOOL GetProtectScenarios();void Select(const VARIANTvoid Unprotect(const VARIANTlong GetVisible();void SetVisible(l
39、ong nNewValue);LPDISPATCH GetShapes();BOOL GetTransitionExpEval();void SetTransitionExpEval(BOOL bNewValue);BOOL GetAutoFilterMode();void SetAutoFilterMode(BOOL bNewValue);void SetBackgroundPicture(LPCTSTR Filename);void Calculate();BOOL GetEnableCalculation();void SetEnableCalculation(BOOL bNewValu
40、e);LPDISPATCH GetCells();LPDISPATCH ChartObjects(const VARIANTvoid CheckSpelling(const VARIANTLPDISPATCH GetCircularReference();void ClearArrows();LPDISPATCH GetColumns();long GetConsolidationFunction();VARIANT GetConsolidationOptions();VARIANT GetConsolidationSources();BOOL GetEnableAutoFilter();vo
41、id SetEnableAutoFilter(BOOL bNewValue);long GetEnableSelection();void SetEnableSelection(long nNewValue);BOOL GetEnableOutlining();void SetEnableOutlining(BOOL bNewValue);BOOL GetEnablePivotTable();void SetEnablePivotTable(BOOL bNewValue);VARIANT Evaluate(const VARIANTVARIANT _Evaluate(const VARIANT
42、BOOL GetFilterMode();void ResetAllPageBreaks();LPDISPATCH GetNames();LPDISPATCH OLEObjects(const VARIANTLPDISPATCH GetOutline();void Paste(const VARIANTLPDISPATCH PivotTables(const VARIANTLPDISPATCH PivotTableWizard(const VARIANTLPDISPATCH GetRange(const VARIANTLPDISPATCH GetRows();LPDISPATCH Scenar
43、ios(const VARIANTCString GetScrollArea();void SetScrollArea(LPCTSTR lpszNewValue);void ShowAllData();void ShowDataForm();double GetStandardHeight();double GetStandardWidth();void SetStandardWidth(double newValue);BOOL GetTransitionFormEntry();void SetTransitionFormEntry(BOOL bNewValue);long GetType(
44、);LPDISPATCH GetUsedRange();LPDISPATCH GetHPageBreaks();LPDISPATCH GetVPageBreaks();LPDISPATCH GetQueryTables();BOOL GetDisplayPageBreaks();void SetDisplayPageBreaks(BOOL bNewValue);LPDISPATCH GetComments();LPDISPATCH GetHyperlinks();void ClearCircles();void CircleInvalid();LPDISPATCH GetAutoFilter(
45、);BOOL GetDisplayRightToLeft();void SetDisplayRightToLeft(BOOL bNewValue);LPDISPATCH GetScripts();void PrintOut(const VARIANTLPDISPATCH GetTab();LPDISPATCH GetMailEnvelope();void SaveAs(LPCTSTR Filename, const VARIANTLPDISPATCH GetCustomProperties();LPDISPATCH GetSmartTags();LPDISPATCH GetProtection
46、();void PasteSpecial(const VARIANTvoid Protect(const VARIANTLPDISPATCH GetListObjects();LPDISPATCH XmlDataQuery(LPCTSTR XPath, const VARIANTLPDISPATCH XmlMapQuery(LPCTSTR XPath, const VARIANT;/ _Workbook wrapper classclass _Workbook : public COleDispatchDriverpublic:_Workbook() / Calls COleDispatchD
47、river default constructor_Workbook(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) _Workbook(const _Workbooklong GetCreator();LPDISPATCH GetParent();BOOL GetAcceptLabelsInFormulas();void SetAcceptLabelsInFormulas(BOOL bNewValue);void Activate();LPDISPATCH GetActiveChart();LPDISPATCH GetActiveS
48、heet();long GetAutoUpdateFrequency();void SetAutoUpdateFrequency(long nNewValue);BOOL GetAutoUpdateSaveChanges();void SetAutoUpdateSaveChanges(BOOL bNewValue);long GetChangeHistoryDuration();void SetChangeHistoryDuration(long nNewValue);LPDISPATCH GetBuiltinDocumentProperties();void ChangeFileAccess(long Mode, const VARIANTvoid ChangeLink(LPCTSTR Name, LPCTSTR NewName, long Type);LPDISPATCH GetCharts();void Close(const VARIANTCString GetCodeName();CString Get_CodeName();void Set_CodeName(LPCTSTR lpszNewValue);VARIANT GetColors(const VARIANTvoid SetColors(