对于当前代码:
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
我想要的只是一个预定义的工作簿来添加工作表