怎么用c++从excel中读入数据

来源:百度知道 编辑:UC知道 时间:2024/06/01 19:36:07

使用Visual C++的扩展指令#import:

#import "C:\\Program Files\\Common Files\\microsoft shared\\OFFICE14\\MSO.DLL" \

rename("RGB","MsoRGB") \
rename("SearchPath","MsoSearchPath")

#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB"

#import "C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE" \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" ) \
exclude( "IFont", "IPicture" ) no_dual_interfaces

#import指令会从指定的可执行文件,动态链接库等COM组件中导出类型库(type lib),在Debug和Release临时