C++操作Excel.pdf
C+操 作 Excel所需要的Excel.h,与 Excel.cpp文件介绍:这两个文件使用C+6.0导出的,并 且 在 Visual Studio 200骁008下测试通过 Excel.CPP文 件 在 第 2 7 页*头文件Excel.h/Machine generated IDispatch wrapper class(es)created with ClassWizard/_Application wrapper classclass _Application:public COIeDispatchDriver(public:_Application()/Calls COIeDispatchDriver default constructor_Application(LPDISPATCH pDispatch):COIeDispatchDriver(pDispatch)_Application(const _Application&dispatchSrc):COIeDispatchDriver(dispatchSrc)/Attributespublic:/Operationspublic:LPDISPATCH GetApplication();long GetCreator();LPDISPATCH GetParent();LPDISPATCH GetActiveCell();LPDISPATCH GetActiveChart();CString GetActivePrinter();void SetActivePrinter(LPCTSTR IpszNewValue);LPDISPATCH GetActiveSheet();LPDISPATCH GetActiveWindow();LPDISPATCH GetActiveWorkbook();LPDISPATCH GetAddlns();LPDISPATCH GetAssistant();void Calculate();LPDISPATCH GetCells();LPDISPATCH GetCharts();LPDISPATCH GetColumns();LPDISPATCH GetCommandBars();long GetDDEAppReturnCode();void DDEExecute(long Channel,LPCTSTR String);long DDEInitiate(LPCTSTR App,LPCTSTR Topic);void DDEPoke(long Channel,const VARIANT&Item,const VARIANT&Data);VARIANT DDERequest(long Channel,LPCTSTR Item);void DDETerminate(long Channel);VARIANT Evaluate(const VARIANT&Name);VARIANT _Evaluate(const VARIANT&Name);VARIANT ExecuteExcel4Macro(LPCTSTR String);LPDISPATCH lntersect(LPDISPATCH Argl,LPDISPATCH Arg2,const VARIANT&Arg3,constVARIANT&Arg4,const VARIANT&Arg57 const VARIANT&Arg6,const VARIANT&Arg7,constVARIANT&Arg8,const VARIANT&Arg9z const VARIANT&ArglO,const VARIANT&Argil,const VARIANT&Argl2,const VARIANT&Argl3,constVARIANT&Argl4,const VARIANT&Argl5,const VARIANT&Argl6,const VARIANT&Argl7,constVARIANT&Argl8,const VARIANT&Argl9z const VARIANT&Arg20,const VARIANT&Arg21,const VARIANT&Arg22,const VARIANT&Arg23,constVARIANT&Arg24,const VARIANT&Arg25,const VARIANT&Arg26,const VARIANT&Arg27,constVARIANT&Arg28,const VARIANT&Arg29,const VARIANT&Arg30);LPDISPATCH GetNames();LPDISPATCH GetRange(const VARIANT&Celli,const VARIANT&Cell2);LPDISPATCH GetRows();VARIANT Run(const VARIANT&Macro,const VARIANT&Argl,const VARIANT&Arg2,constVARIANT&Arg3,const VARIANT&Arg4,const VARIANT&Arg5z const VARIANT&Arg6,constVARIANT&Arg7,const VARIANT&Arg8,const VARIANT&Arg9,const VARIANT&ArglO,const VARIANT&Argil,const VARIANT&Argl2,constVARIANT&Argl3,const VARIANT&Argl4,const VARIANT&Argl5,const VARIANT&Argl6,constVARIANT&Argl7,const VARIANT&Argl8,const VARIANTS Argl9,const VARIANT&Arg20,const VARIANT&Arg21,const VARIANT&Arg22,constVARIANT&Arg23,const VARIANT&Arg24,const VARIANT&Arg25z const VARIANT&Arg26,constVARIANT&Arg27,const VARIANT&Arg28,const VARIANT&Arg29,const VARIANT&Arg30);VARIANT _Run2(const VARIANT&Macro,const VARIANT&Argl,const VARIANT&Arg2,constVARIANT&Arg3,const VARIANT&Arg4z const VARIANT&Arg5,const VARIANT&Arg6,constVARIANT&Arg7,const VARIANT&Arg8,const VARIANT&Arg9,const VARIANT&ArglO,const VARIANT&Argil,const VARIANT&Argl2,constVARIANT&Argl3,const VARIANT&Argl4,const VARIANT&Argl5,const VARIANT&Argl6,constVARIANT&Argl7z const VARIANT&Argl8,const VARIANT&Argl9,const VARIANT&Arg20,const VARIANT&Arg21,const VARIANT&Arg22,constVARIANT&Arg23,const VARIANT&Arg24,const VARIANT&Arg25,const VARIANT&Arg26,constVARIANT&Arg27,const VARIANT&Arg28,const VARIANT&Arg29,const VARIANT&Arg30);LPDISPATCH GetSelection();void SendKeys(const VARIANT&Keys,const VARIANT&Wait);LPDISPATCH GetSheets();LPDISPATCH GetThisWorkbook();LPDISPATCH Union(LPDISPATCH Argl,LPDISPATCH Arg2,const VARIANT&Arg3,constVARIANT&Arg4,const VARIANT&Arg5,const VARIANT&Arg6,const VARIANT&Arg7,constVARIANT&Arg8,const VARIANT&Arg9,const VARIANT&ArglO,const VARIANT&Argil,const VARIANT&Argl2,const VARIANT&Argl3,const VARIANT&Argl4z constVARIANT&Argl5,const VARIANT&Argl6,const VARIANT&Argl7,const VARIANT&Argl8z constVARIANT&Argl9,const VARIANT&Arg20,const VARIANT&Arg21,const VARIANT&Arg22,const VARIANT&Arg23,const VARIANT&Arg24,constVARIANT&Arg25,const VARIANT&Arg26,const VARIANT&Arg27,const VARIANT&Arg28,constVARIANT&Arg29,const VARIANT&Arg30);LPDISPATCH GetWindows();LPDISPATCH GetWorkbooks();LPDISPATCH GetWorksheetFunction();LPDISPATCH GetWorksheets();LPDISPATCH GetExcel4lntlMacroSheets();LPDISPATCH GetExcel4MacroSheets();void ActivateMicrosoftApp(long Index);void AddChartAutoFormat(const VARIANT&Chart,LPCTSTR Name,const VARIANT&Description);void AddCustomList(const VARIANT&ListArray,const VARIANT&ByRow);BOOL GetAlertBeforeOverwritingO;void SetAlertBeforeOverwriting(BOOL bNewValue);CString GetAltStartupPath();void SetAltStartupPath(LPCTSTR IpszNewValue);BOOL GetAskToUpdateLinks();void SetAskTollpdateLinks(BOOL bNewValue);BOOL GetEnableAnimations();void SetEnableAnimations(BOOL bNewValue);LPDISPATCH GetAutoCorrect();long GetBuild();BOOL GetCalculateBeforeSave();void SetCalculateBeforeSave(BOOL bNewValue);long GetCalculation();void SetCalculation(long nNewValue);VARIANT GetCaller(const VARIANT&Index);BOOL GetCanPlaySounds();BOOL GetCanRecordSounds();CString GetCaption();void SetCaption(LPCTSTR IpszNewValue);BOOL GetCellDragAndDrop();void SetCellDragAndDrop(BOOL bNewValue);double CentimetersToPoints(double Centimeters);BOOL CheckSpelling(LPC7rSTR Word,const VARIANT&CustomDictionary,const VARIANT&IgnoreUppercase);VARIANT GetClipboardFormats(const VARIANT&Index);BOOL GetDisplayClipboardWindow();void SetDisplayClipboardWindow(BOOL bNewValue);long GetCommandUnderlinesO;void SetCommandUnderlines(long nNewValue);BOOL GetConstrainNumeric();void SetConstrainNumeric(BOOL bNewValue);VARIANT ConvertFormula(const VARIANT&Formula,long From Ref e re n ce Sty I e,constVARIANT&ToReferenceStyle,const VARIANT&ToAbsolute,const VARIANT&RelativeTo);BOOL GetCopyObjectsWithCells();void SetCopyObjectsWithCells(BOOL bNewValue);long GetCursor();void SetCursor(long nNewValue);long GetCustomListCount();long GetCutCopyMode();void SetCutCopyMode(long nNewValue);long GetDataEntryMode();void SetDataEntryMode(long nNewValue);CString Get_Default();CString GetDefaultFilePath();void SetDefaultFilePath(LPCTSTR IpszNewValue);void DeleteChartAutoFormat(LPCTSTR Name);void DeleteCustomList(long ListNum);LPDISPATCH GetDialogs();BOOL GetDisplayAlerts();void SetDisplayAlerts(BOOL bNewValue);BOOL GetDisplayFormulaBarO;void SetDisplayFormulaBar(BOOL bNewValue);BOOL GetDisplayFullScreen();void SetDisplayFullScreen(BOOL bNewValue);BOOL GetDisplayNotelndicator();void SetDisplayNotelndicator(BOOL bNewValue);long GetDisplayCommentlndicatorO;void SetDisplayCommentlndicator(long nNewValue);BOOL GetDisplayExcel4Menus();void SetDisplayExcel4Menus(BOOL bNewValue);BOOL GetDisplayRecentFiles();void SetDisplayRecentFiles(BOOL bNewValue);BOOL GetDisplayScrollBars();void SetDisplayScrollBars(BOOL bNewValue);BOOL GetDisplayStatusBar();void SetDisplayStatusBar(BOOL bNewValue);void DoubleClick();BOOL GetEditDirectlylnCell();void SetEditDirectlylnCell(BOOL bNewValue);BOOL GetEnableAutoComplete();void SetEnableAutoComplete(BOOL bNewValue);long GetEnableCancelKey();void SetEnableCancelKey(long nNewValue);BOOL GetEnableSound();void SetEnableSound(BOOL bNewValue);VARIANT GetFileConverters(const VARIANT&Indexl,const VARIANT&Index2);LPDISPATCH GetFileSearch();LPDISPATCH GetFileFind();BOOL GetFixedDecimal();void SetFixedDecimal(BOOL bNewValue);long GetFixedDecimalPlaces();void SetFixedDecimalPlaces(long nNewValue);VARIANT GetCustomListContents(long ListNum);long GetCustomListNum(const VARIANT&ListArray);VARIANT GetOpenFilename(const VARIANT&FileFilter,const VARIANT&Filterindex,constVARIANT&Title,const VARIANT&ButtonText,const VARIANT&MultiSelect);VARIANT GetSaveAsFilename(const VARIANT&InitialFilename,const VARIANT&FileFilter,const VARIANT&Filterindex,const VARIANT&Title,const VARIANT&ButtonText);void Goto(const VARIANT&Reference,const VARIANT&Scroll);double GetHeight();void SetHeight(double newValue);void Help(const VARIANT&HelpFile,const VARIANT&HelpContextID);BOOL GetlgnoreRemoteRequests();void SetlgnoreRemoteRequests(BOOL bNewValue);double lnchesToPoints(double Inches);VARIANT lnputBox(LPCTSTR Prompt,const VARIANT&Title,const VARIANT&Default,constVARIANT&Left,const VARIANT&Top,const VARIANT&HelpFile,const VARIANT&HelpContextID,const VARIANT&Type);BOOL Getlnteractive();void Setlnteractive(BOOL bNewValue);VARIANT Getlnternational(const VARIANT&Index);BOOL Getlteration();void Setlteration(BOOL bNewValue);double GetLeft();void SetLeft(double newValue);CString GetLibraryPath();void MacroOptions(const VARIANT&Macro,const VARIANT&Description,const VARIANT&HasMenu,const VARIANT&MenuText,const VARIANT&HasShortcutKey,const VARIANT&ShortcutKey,const VARIANT&Category,const VARIANT&StatusBar,const VARIANT&HelpContextID,const VARIANT&HelpFile);void MailLogoff();void MailLogon(const VARIANT&Name,const VARIANT&Password,const VARIANT&DownloadNewMail);VARIANT GetMailSession();long GetMailSystem();BOOL GetMathCoprocessorAvailable();double GetMaxChange();void SetMaxChange(double newValue);long GetMaxlterations();void SetMaxlterations(long nNewValue);BOOL GetMouseAvailable();BOOL GetMoveAfterReturn();void SetMoveAfterReturn(BOOL bNewValue);long GetMoveAfterReturnDirection();void SetMoveAfterReturnDirection(long nNewValue);LPDISPATCH GetRecentFiles();CString GetName();LPDISPATCH NextLetter();CString GetNetworkTemplatesPath();LPDISPATCH GetODBCErrors();long GetODBCTimeout();void SetODBCTimeout(long nNewValue);void OnKey(LPCTSTR Key,const VARIANT&Procedure);void OnRepeat(LPCTSTR Text,LPCTSTR Procedure);void OnTime(const VARIANT&EarliestTime,LPCTSTR Procedure,const VARIANT&LatestTime,const VARIANT&Schedule);void OnUndo(LPCTSTR Text,LPCTSTR Procedure);CString GetOnWindow();void SetOnWindow(LPCTSTR IpszNewValue);CString GetOperatingSystem();CString GetOrganizationName();CString GetPath();CString GetPathSeparator();VARIANT GetPreviousSelections(const VARIANT&Index);BOOL GetPivotTableSelection();void SetPivotTableSelection(BOOL bNewValue);BOOL GetPromptForSummarylnfo();void SetPromptForSummarylnfo(BOOL bNewValue);void Quit();void RecordMacro(const VARIANT&BasicCode,const VARIANT&XlmCode);BOOL GetRecordRelative();long GetReferenceStyle();void SetReferenceStyle(long nNewValue);VARIANT GetRegisteredFunctions(const VARIANT&Indexl,const VARIANT&Index2);BOOL RegisterXLL(LPCTSTR Filename);void Repeat();BOOL GetRollZoomO;void SetRollZoom(BOOL bNewValue);void SaveWorkspace(const VARIANT&Filename);BOOL GetScreenUpdatingO;void SetScreenllpdating(BOOL bNewValue);void SetDefaultChart(const VARIANT&FormatName,const VARIANT&Gallery);long GetSheetslnNewWorkbook();void SetSheetslnNewWorkbook(long nNewValue);BOOL GetShowChartTipNames();void SetShowChartTipNames(BOOL bNewValue);BOOL GetShowChartTipValues();void SetShowChartTipValues(BOOL bNewValue);CString GetStandardFont();void SetStandardFont(LPCTSTR IpszNewValue);double GetStandardFontSize();void SetStandardFontSize(double newValue);CString GetStartupPath();VARIANT GetStatusBar();void SetStatusBar(const VARIANT&newValue);CString GetTemplatesPath();BOOL GetShowToolTips();void SetShowToolTips(BOOL bNewValue);double GetTop();void SetTop(double newValue);long GetDefaultSaveFormatO;void SetDefaultSaveFormat(long nNewValue);CString GetTransitionMenuKey();void SetTransitionMenuKey(LPCTSTR IpszNewValue);long GetTransitionMenuKeyAction();void SetTransitionMenuKeyAction(long nNewValue);BOOL GetTransitionNavigKeys();void SetTransitionNavigKeys(BOOL bNewValue);void Undo();double GetUsableHeight();double GetUsableWidth();BOOL GetUserControl();void SetUserControl(BOOL bNewValue);CString GetUserName_();void SetUserName(LPCTSTR IpszNewValue);CString GetValue();LPDISPATCH GetVbe();CString GetVersion();BOOLGetVisible();void SetVisible(BOOL bNewValue);void Volatile(const VARIANT&Volatile);double GetWidth();void SetWidth(double newValue);BOOL GetWindowsForPens();long GetWindowState();void SetWindowState(long nNewValue);long GetDefaultSheetDirection();void SetDefaultSheetDirection(long nNewValue);long GetCursorMovement();void SetCursorMovement(long nNewValue);BOOL GetControlCharacters();void SetControlCharacters(BOOL bNewValue);BOOL GetEnableEvents();void SetEnableEvents(BOOL bNewValue);BOOL Wait(const VARIANT&Time);BOOL GetExtendList();void SetExtendList(BOOL bNewValue);LPDISPATCH GetOLEDBErrors();CString GetPhonetic(const VARIANT&Text);LPDISPATCH GetCOMAddlns();LPDISPATCH GetDefaultWebOptions();CString GetProductCode();CString GetUserLibraryPath();BOOL GetAutoPercentEntry();void SetAutoPercentEntry(BOOL bNewValue);LPDISPATCH GetLanguageSettings();LPDISPATCH GetAnswerWizard();void CalculateFull();BOOLFindFile();long GetCalculationVersion();BOOL GetShowWindowslnTaskbar();void SetShowWindowslnTaskbar(BOOL bNewValue);long GetFeaturelnstall();void SetFeaturelnstall(long nNewValue);BOOLGetReadyO;LPDISPATCH GetFindFormat();void SetRefFindFormat(LPDISPATCH newValue);LPDISPATCH GetReplaceFormat();void SetRefReplaceFormat(LPDISPATCH newValue);LPDISPATCH GetUsedObjects();long GetCalculationState();long GetCalculationlnterruptKey();void SetCalculationlnterruptKey(long nNewValue);LPDISPATCH GetWatches();BOOL GetDisplayFunctionToolTips();void SetDisplayFunctionToolTips(BOOL bNewValue);long GetAutomationSecurityO;void SetAutomationSecurity(long nNewValue);LPDISPATCH GetFileDialog(long fileDialogType);void CalculateFullRebuild();BOOL GetDisplayPasteOptions();void SetDisplayPasteOptions(BOOL bNewValue);BOOL GetDisplaylnsertOptions();void SetDisplaylnsertOptions(BOOL bNewValue);BOOL GetGenerateGetPivotData();void SetGenerateGetPivotData(BOOL bNewValue);LPDISPATCH GetAutoRecover();long GetHwnd();long GetHinstance();void CheckAbort(const VARIANT&KeepAbort);LPDISPATCH GetErrorCheckingOptions();BOOL GetAutoFormatAsYouTypeReplaceHyperlinks();void SetAutoFormatAsYouTypeReplaceHyperlinks(BOOL bNewValue);LPDISPATCH GetSmartTagRecognizers();LPDISPATCH GetNewWorkbook();LPDISPATCH GetSpellingOptions();LPDISPATCH GetSpeech();BOOL GetMapPaperSize();void SetMapPaperSize(BOOL bNewValue);BOOL GetShowStartupDialog();void SetShowStartupDialog(BOOL bNewValue);CString GetDecimalSeparator();void SetDecimalSeparator(LPCTSTR IpszNewValue);CString GetThousandsSeparator();void SetThousandsSeparator(LPCTSTR IpszNewValue);BOOL G et U seSy ste mSe pa ra to rs();void SetUseSystemSeparators(BOOL bNewValue);LPDISPATCH GetThisCell();LPDISPATCH GetRtd();BOOL GetDisplayDocumentActionTaskPane();void SetDisplayDocumentActionTaskPane(BOOL bNewValue);void DisplayXMLSourcePane(const VARIANT&XmlMap);BOOL GetArbitraryXMLSupportAvailable(););lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll Worksheet wrapper classclass _Worksheet:public COIeDispatchDriver(public:_Worksheet()/Calls COIeDispatchDriver default constructor_Worksheet(LPDISPATCH pDispatch):COIeDispatchDriver(pDispatch)_Worksheet(const _Worksheet&dispatchSrc):COIeDispatchDriver(dispatchSrc)/Attributespublic:/Operationspublic:LPDISPATCH GetApplication();long GetCreator();LPDISPATCH GetParent();void Activate();void Copy(const VARIANT&Before,const VARIANT&After);void Delete();CString GetCodeName();CString Get_CodeName();void Set_CodeName(LPCTSTR IpszNewValue);long Getlndex();