错误:80040154类未注册 [英] Error: 80040154 class not registered
本文介绍了错误:80040154类未注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过添加visio的互操作引用来在Microsoft Visual Studio 2013中使用Microsoft Visio 2010 32位。
但是我收到以下COM异常错误:
由于以下错误,使用CLSID {000D0A00-0000-0000-C000-000000000046}重新组装COM类工厂失败:80040154未注册类(HRESULT异常) :0x80040154(REGDB_E_CLASSNOTREG))。
我的尝试:
使用System;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
使用Visio = Microsoft.Office.Interop.Visio;
命名空间CreateVisioDrawing
{
公共类程序
{
public static void Main(string [] args)
{
//System.Diagnostics.Debugger.Launch();
CreateDrawing objCreateDrawing = new CreateDrawing();
objCreateDrawing.CreteNewDrawing();
}
}
公共类CreateDrawing
{
public void CreteNewDrawing()
{
try
{
Visio.Documents visioDocs = new Visio.Documents();
string drawingPath = @E:\ Local Data \ NEWW DATA_20170510 \VisioDrawings\NewDrawing.vsd;
visioDocs.Add(drawingPath);
Visio.Document visioStencil = visioDocs.OpenEx(Basic Shapes.vss,
(短)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked);
Visio.Page visioPage = new Visio.Page();
Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU(@Rectangle);
Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster,4.25,5.5);
visioRectShape.Text = @矩形文字。;
Visio.Master visioStarMaster = visioStencil.Masters.get_ItemU(@Star 7);
Visio.Shape visioStarShape = visioPage.Drop(visioStarMaster,2.0,5.5);
visioStarShape.Text = @Star text。;
Visio.Master visioHexagonMaster = visioStencil.Masters.get_ItemU(@Hexagon);
Visio.Shape visioHexagonShape = visioPage.Drop(visioHexagonMaster,7.0,5.5);
visioHexagonShape.Text = @Hexagon text。;
}
catch(exception ex)
{
Console.WriteLine(ex.Message);
Console.Read();
}
}
}
}
解决方案
如果你得到一条错误消息,你不明白,谷歌它: 80040154类未注册(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG)) - Google搜索 [ ^ ] - 就像在这种情况下,它为很多其他人提供了相同的问题,以及解决方案他们将适用于您。
甚至......只需阅读信息的文本即可。这很清楚明显! :笑:
I'm trying to work on Microsoft Visio 2010 32 bit in Microsoft Visual Studio 2013 by adding the interop reference of the visio.
But I'm getting the following COM Exception error:
Retriving the COM class factory for component with CLSID {000D0A00-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
What I have tried:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Visio = Microsoft.Office.Interop.Visio; namespace CreateVisioDrawing { public class Program { public static void Main(string[] args) { //System.Diagnostics.Debugger.Launch(); CreateDrawing objCreateDrawing = new CreateDrawing(); objCreateDrawing.CreteNewDrawing(); } } public class CreateDrawing { public void CreteNewDrawing() { try { Visio.Documents visioDocs = new Visio.Documents(); string drawingPath = @"E:\Local Data\NEW DATA_20170510\VisioDrawings\NewDrawing.vsd"; visioDocs.Add(drawingPath); Visio.Document visioStencil = visioDocs.OpenEx("Basic Shapes.vss", (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenDocked); Visio.Page visioPage = new Visio.Page(); Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU(@"Rectangle"); Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster, 4.25, 5.5); visioRectShape.Text = @"Rectangle text."; Visio.Master visioStarMaster = visioStencil.Masters.get_ItemU(@"Star 7"); Visio.Shape visioStarShape = visioPage.Drop(visioStarMaster, 2.0, 5.5); visioStarShape.Text = @"Star text."; Visio.Master visioHexagonMaster = visioStencil.Masters.get_ItemU(@"Hexagon"); Visio.Shape visioHexagonShape = visioPage.Drop(visioHexagonMaster, 7.0, 5.5); visioHexagonShape.Text = @"Hexagon text."; } catch (Exception ex) { Console.WriteLine(ex.Message); Console.Read(); } } } }
解决方案
If you get an error message you don;t understand, Google it: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) - Google Search[^] - as in this case, it provides a lot of others with the same problem, and solutions to theirs will apply to you.
Or even ... just read the text of the message. It's pretty clear and obvious! :laugh:
这篇关于错误:80040154类未注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文