text: Eclipse Community Forums - RDF feed Eclipse Community Forums SWT MS Word Save Button <![CDATA[Hello, I'm trying to use MS Word 2010 in a SWT-Application. I can open a File but the Save-Button of Word is not enabled. With an additional Button, wich executes the save-Method of the OleClientSite saves the document. Here is my Code: public class Main { /** * @param args */ public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(600, 400); shell.setText("WordTest"); shell.setLayout(new FillLayout(SWT.VERTICAL)); final File f = new File("C:\\test.pptx"); OleFrame oleFrame = new OleFrame(shell, SWT.NONE); final OleClientSite site = new OleClientSite(oleFrame, SWT.NONE, f); site.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent arg0) { System.out.println("Disposed"); } }); shell.layout(); site.doVerb(OLE.OLEIVERB_SHOW); Menu bar = new Menu(shell, SWT.BAR); shell.setMenuBar(bar); MenuItem file = new MenuItem(bar, SWT.CASCADE); file.setText("&File"); Menu sub = new Menu (shell, SWT.DROP_DOWN); file.setMenu (sub); MenuItem item = new MenuItem (sub, SWT.PUSH); item.setText("&Save"); item.addListener (SWT.Selection, new Listener () { public void handleEvent (Event e) { site.save(f, false); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } Please help me! ]]> Hans Dampf 2011-03-17T09:30:50-00:00 Re: SWT MS Word Save Button <![CDATA[I would expect this menu item to be enabled. Try using OleFrame#setFileMenus (sorry but I can't test your code because I do not have office 2010) ]]> Felipe Heidrich 2011-03-23T15:47:20-00:00 Re: SWT MS Word Save Button <![CDATA[But i do not have a FileItem MenuItem, because the save button is an item of Word I think it has something to do with the OleClientSite, because it "contains" the Word application. I tried to use the method exec like this: site.exec(OLE.OLECMDID_SAVEAS, OLE.OLECMDEXECOPT_DODEFAULT, null, null); I get an error from Word that says, that the storage process can't be completed because of a file permission error. (Please ignore me bad english:) )]]> Hans Dampf 2011-03-24T07:46:43-00:00 Re: SWT MS Word Save Button <![CDATA[Hi, I am facing the same problem : When embedding MSWord2010 with an OleClientSite, the save button in the "ribbon" is disabled. And trying to invoke the document's Save methode does nothing (with error message : The Save method or property is not available because this document is in another application If I use an OleControlSite, it does work but the document is opened outside of my swt app, as a standalone window... Have you found out what's wrong? Thanks in advance!]]> Alexandre Borgoltz 2013-01-31T17:04:31-00:00