[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] Re: Embedding Word or Excelsheet documents in SWT shell
|
Hi,
Here is a working example:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
GridLayout shellLayout = new GridLayout();
shellLayout.numColumns = 1;
shellLayout.marginHeight = 0;
shellLayout.marginWidth = 0;
shellLayout.verticalSpacing = 0;
shell.setLayout(shellLayout);
OleFrame frame = new OleFrame(shell, SWT.NONE);
GridData frameGridData = new GridData(GridData.FILL_BOTH);
frameGridData.horizontalAlignment = GridData.FILL;
frameGridData.verticalAlignment = GridData.FILL;
frame.setLayoutData(browserFrameGridData);
File file = new File("C:\\test.doc");
OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, file);
clientSite.doVerb(OLE.OLEIVERB_PRIMARY);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
> I was trying to embed a word document or an MS Excelsheet into a dialog but
> could not do that. Is it not possible to do that ?
> The following code that I tried opened the word document or excelsheet in
> MS Word or MS Excel respectively and the dialog was empty.
> I tried, with no success, the different constants in OLE class as a
parameter in
> the doVerb method.
> Chandresh
> Code ::
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> OleFrame frame = new OleFrame(shell, SWT.NONE);
> File file = new File("D:\\junk.doc");//downloads\\Expense
> Accounts.xls");
> OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, file);
> clientSite.doVerb(OLE.OLEIVERB_PRIMARY);
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }