Eclipse plugin 在OLE编辑器中保存XLS
如果使用64位EclipseIDE,大多数旧的Office格式(DOC、XLS、PPT)甚至无法打开。因此,SWT框架也不能处理它们也就不足为奇了。您可以强制使用不推荐使用的API,但即使如此,由于某些原因,您也无法存储XLS文件 独立测试:Eclipse plugin 在OLE编辑器中保存XLS,eclipse-plugin,swt,Eclipse Plugin,Swt,如果使用64位EclipseIDE,大多数旧的Office格式(DOC、XLS、PPT)甚至无法打开。因此,SWT框架也不能处理它们也就不足为奇了。您可以强制使用不推荐使用的API,但即使如此,由于某些原因,您也无法存储XLS文件 独立测试: final File file = // insert file here Display display = new Display(); Shell shell = new Shell(display); shell.setText(file.getN
final File file = // insert file here
Display display = new Display();
Shell shell = new Shell(display);
shell.setText(file.getName());
shell.setLayout(new GridLayout());
shell.setSize(800, 600);
OleFrame frame = new OleFrame(shell, SWT.NONE);
frame.setLayoutData(new GridData(GridData.FILL_BOTH));
final OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, "Excel.Sheet", file);
Button button = new Button(shell, SWT.NONE);
button.setText("Save");
button.addListener(SWT.Selection, e -> clientSite.save(file, true));
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
没有例外,没有日志,什么都没有。这根本救不了你OleClientSite.isDirty()
也没有设置为false
如何使用SWT的OLE框架保存XLS文件