找到解决方法了:不是直接引入mswork.tlh文件的,该文件是#import "C:\Program Files\Microsoft Office\Office12\MSWORD.OLB"后,编译器自动生成的中间文件,但是这样还是会出现命名空间重复的错误,完整的解决方法如下代码
1
2
3
4
5
6
7
8
|
#import "C:Program FilesCommon FilesMicrosoft SharedOFFICE12MSO.DLL" #import "C:Program FilesCommon FilesMicrosoft SharedVBAVBA6VBE6EXT.OLB" #import "C:\Program Files\Microsoft Office\Office12\MSWORD.OLB" no_namespace raw_interfaces_only rename ( "FindText" , "_FindText" ) rename ( "RGB" , "_RGB" ) rename ( "Rectangle" , "_Rectangle" ) rename ( "ExitWindows" , "_ExitWindows" ) rename ( "Font" , "WordFont" ) |