【发布时间】:2012-06-05 12:02:17
【问题描述】:
对于当前代码:
String currentPath = Directory.GetCurrentDirectory();
OpenFileDialog op = new OpenFileDialog();
op.InitialDirectory = currentPath;
if (op.ShowDialog() == DialogResult.OK)
currentPath = op.FileName;
else
{
toolStripStatusLabel1.Text = "Failed to Load Workbook";
toolStripStatusLabel1.Visible = true;
}
Workbook wb = new Workbook(excel.Workbooks.Open(currentPath));
我收到错误:
System.Runtime.InteropServices.COMException 未处理 消息=检索具有 CLSID {00020819-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败,原因是以下错误:80040154 未注册类(HRESULT 异常:0x80040154 (REGDB_E_CLASSNOTREG))。 源=mscorlib 错误码=-2147221164
我只想要一个预定义的工作簿来添加工作表
【问题讨论】:
标签: c# visual-studio-2010 excel excel-interop