2

I am trying to integrate Visio 2007 with C# (VS 2012 and windows 7 OS) but I am getting error while running the code

Unable to cast COM object of type 'Microsoft.Office.Interop.Visio.ApplicationClass' to interface type 'Microsoft.Office.Interop.Visio.IVApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000D0700-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

Code snippet :

using IVisio = Microsoft.Office.Interop.Visio;

Inside method

 var app = new IVisio.ApplicationClass();
        var docs = app.Documents;  (Error coming at this point)
        var doc = docs.Add("");

        var page = app.ActivePage;
        var shape0 = page.DrawRectangle(1, 2, 6, 3);
        shape0.Text = "Hello World";

I have Microsoft office 2010 installed with Visio 2007 on my machine.

Reference Library : Microsoft.Office.Interop.Visio (tried Microsoft Visio 12 Type Library version 4.12.0.0 (visio 2007) and version 14.0.0.0 (visio 2010) but getting the same error.)

4

1 回答 1

0

我已经删除了 Office 2010 和 visio 2007 ,重新启动机器并再次安装了 office 2010 和 visio 2007 软件。这已经奏效。

我一直在寻找除此之外的任何其他解决方案。

于 2013-08-22T03:07:47.023 回答