当前位置 : 主页 > 编程语言 > c语言 >

如何在VB.Net中使用Adobe Indesign API

来源:互联网 收集:自由互联 发布时间:2021-06-24
我有一个excel的示例添加: 我创建了一个对象InDesign.Application Dim myInDesign As InDesign.Application Dim myDoc As InDesign.Document Dim myPage As InDesign.Page myInDesign = CType(Activator.CreateInstance(Type.GetTypeFromP
我有一个excel的示例添加:
我创建了一个对象InDesign.Application

Dim myInDesign As InDesign.Application
        Dim myDoc As InDesign.Document
        Dim myPage As InDesign.Page

        myInDesign = CType(Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"), True), InDesign.Application)
        myDoc = myInDesign.Documents.Add    
        myDoc = myInDesign.ActiveDocument

InDesign打开,但加载项显示错误:

`myInDesign = CType(Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Application"), True), InDesign.Application)`

错误内容:

Unable to cast COM object of type 'System.__ComObject' to interface type 'InDesign.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

为什么?你能帮助我吗?

您是否使用vb.net的com接口添加了对InDesign类型库的引用?

在Visual Studio中打开引用面板,然后选择“COM”选项卡,并在列表中查找InDesign.它将默认为Copy Local = False.

现在您可以像编写vbs一样使用COM函数.

网友评论