Home > Software engineering > Do not use MFC, in pure C implementation of excel spreadsheet import and export, including cell and
Do not use MFC, in pure C implementation of excel spreadsheet import and export, including cell and
Time:10-05
As title, the great god genuflect is begged instruct me ah, don't written in MFC above, only be written in c + +, the eldest brother help ~
CodePudding user response:
Introduction of COM MFC like c + +
//TO DO: Edit the # import paths //# pragma message (" Make sure you go to view the Options. The Directories and add the paths to mso97. DLL and vbeext1. The olb. Mso97. DLL will usually be a c: \ \ \ "\ Program Files \ Microsoft Office " \ \ \ "" \ \ Office, and vbeext1. The olb will be in c: \ \ " \ Program Files \ \ \ \ "" Common Files " \ \ \ "Microsoft Shared \ \ " VBA ") # import "C: \ \ Program Files \ \ Common Files \ \ Microsoft Shared \ \ Office11 \ \ the oledata.mso DLL" no_namespace rename (" DocumentProperties ", "DocumentPropertiesXL") # import "C: \ \ Program Files \ \ Common Files \ \ Microsoft Shared \ \ VBA \ VBA6 \ \ VBE6EXT OLB" no_namespace # import "C: \ \ Program Files \ \ Microsoft Office \ \ OFFICE11 \ \ excel exe" rename (" DialogBox ", "DialogBoxXL") rename (" RGB ", "RBGXL") rename (" DocumentProperties ", "DocumentPropertiesXL") no_dual_interfaces
# pragma warning (4192) disable:
#include #include
Void dump_com_error (_com_error & amp; E) { _tprintf (_T (" Oops - hit an error! \ n ")); _tprintf (_T (" \ \ a tCode=% 08 lx \ n "), e.E rror ()); _tprintf (_T (" \ \ a tCode fancy=% s \ n "), e.E rrorMessage ()); _bstr_t bstrSource (e.S ource ()); _bstr_t bstrDescription (e.D escription ()); _tprintf (_T (" \ \ a tSource=% s \ n "), (LPCTSTR) bstrSource); _tprintf (_T (" \ \ a tDescription=% s \ n "), (LPCTSTR) bstrDescription); }
//If this is placed in the scope of the smart Pointers, they must be //explicitly Release (d) before CoUninitialize () is called. If any reference //count is non - zero, a protection fault will occur. Struct StartOle { StartOle () {CoInitialize (NULL); } ~ StartOle () {CoUninitialize (); } } _inst_StartOle;