gpt4 book ai didi

java - 在注册表中找不到客户端 ID - OLE 打开 XSLX 文档错误

转载 作者:太空宇宙 更新时间:2023-11-04 12:00:15 27 4
gpt4 key购买 nike

当我想通过 SWT OleClient 显示 EXCEL 文件时,出现以下错误:

final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
File openFile = new File("D:\\eDefterKutuphanesi\\eDefter\\excel.xlsx");
OleFrame frame = new OleFrame(shell, SWT.NONE);
OleClientSite site2 = new OleClientSite(frame,SWT.NONE,"D:\\test.xlsx");

错误消息:

Exception in thread "main" org.eclipse.swt.SWTException: Class ID not found in registry 
at org.eclipse.swt.ole.win32.OLE.error(OLE.java:317)
at org.eclipse.swt.ole.win32.OLE.error(OLE.java:283)
at org.eclipse.swt.ole.win32.OleClientSite.<init>(OleClientSite.java:226)
at infina.accounting.reports.views.ExcelDonusturView.main(ExcelDonusturView.java:438)

最佳答案

试试这个:

final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
OleFrame frame = new OleFrame(shell, SWT.NONE);
OleClientSite site = new OleClientSite(frame, SWT.NONE, "Excel.Sheet", new File("D:\\test.xlsx"));

您将 "D:\\test.xlsx" 作为第三个参数传递,该参数应该是 progId,对于 Excel,它是 "Excel.Sheet"

另请确保您的计算机上安装了 Microsoft Excel。
在注册表中找不到类 ID 表示缺少所需的应用程序。

关于java - 在注册表中找不到客户端 ID - OLE 打开 XSLX 文档错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40973852/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com