Hello guys, i'm trying to embed an Excel XML file in a SWT application but it doesn't work at all. It's okay when i do it with a Word XML file it's why it's weird ! I tried with Office 2007 and Office 2010 and the symptoms are the same.
Here my code :
package com.blabla;
import java.io.File;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleControlSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Main {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell(display);
shell.setSize(800, 600);
shell.setLayout(new FillLayout());
OleFrame oleFrame = new OleFrame(shell, SWT.NONE);
OleControlSite oleControlSite = new OleControlSite(oleFrame, SWT.NONE,
"Excel.Sheet", new File(
"C:/Users/Blabla/Desktop/Excel.xml"));
// OleControlSite oleControlSite = new OleControlSite(oleFrame,
// SWT.NONE,
// "Word.Document", new File(
// "C:/Users/Blabla/Desktop/Word.xml"));
oleControlSite.doVerb(OLE.OLEIVERB_SHOW);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
If you know a better place to solve my problem, tell me
Bye guys.