I am trying to be able to use the following code using Office 2007/2010 application SWT Java applications in embedded Am: When I do not try to call 'Open' on the document object, the word embeds successfully inside the application, but the full file menu is disabled. When I open 'application crash call with the following error (DISP_E_EXCEPTION): Finding the ID for 'Open' and 'FILENAME' separately for 'FILENAME Null returns to 'then its wrong. I have also tried the designated parameters without any success:
Import java.awt.Canvas; Import javax.swing.JFrame; Import org.eclipse.swt.SWT; Import org.eclipse.swt.awt.SWT_AWT; Import org.eclipse.swt.layout.FillLayout; Import org.eclipse.swt.ole.win32. *; Import org.eclipse.swt.widgets. *; Public Class Mbedingtast canvas (private void Init Olavivr (String target) increases {display = new Display (); Shell shell = SWT_AWTknew_Shell (performance, this); ShellksetLayout (new FillLayout ()); Olefram Olefrem = New oleframe (shell, SWT.NONE); OleControlSite oleControlSite = new OleControlSite (oleFrame, SWT.NONE, "Word.Document"); oleControlSite.doVerb (OLE.OLEIVERB_INPLACEACTIVATE); oleautomatic word = new allautomation (wet control site); int [ ] ApplicationId = word.getIDsOfNames (new string [] {"application"}); Variient Proper T = Sbdkjetproprti (applicationId [0]); OleAutomation application = property.getAutomation (); Int [] documentId = application.getIDsOfNames (new String [] { "document"}); property = application.getProperty (Dastavejhaidi [0 ]); Olotomasn document = Proprtikjetotomeshn (); Shellkopen (); variants [] arguments = new version [] {new version (target)}; Int [] = AutomationIDs DocumentskgetIDsOfNames (new string [] { " Open "," filename "}); Documents.invokeNoReply (automationIDs [0], logic, new int [] (automationIDs [1]}); While (! Shell.isDisposed ()) {if (! Display.readAndDispatch ()) {display.sleep (); }}} Public static zero main (string [] args) {JFrame jFrame = new JFrame ("embedding test"); JFrame.setVisible (true); Embeddict viewer = new embedding (); JFrame.add (viewer); JFrame.setSize (600, 600); Viewer.initOleViewer (args [0]); }}
formula exception "main" org.eclipse.swt.SWTException: can not be processed. Results -2147352567 (EmbeddingTest.java:68 on org.eclipse.swt.ole.win32.OleAutomation.invokeNoReply (org.eclipse.swt.ole.win32.OLE.error (Unknown Source) at an undisclosed source) on = EmbeddingTest.initOleViewer ) EmbeddingTest.main (EmbeddingTest.java:88) Anyone know how to fix this problem or an alternative solution to fix applications in Office Java for? ! Thanks
update:
documents.invokeNoReply (automationIDs [0], arguments);
Why are you not managing an error, checking results or reasoning? Remember that getIDsOfNames (..) will fail silently and will return the null value for unfamiliar names.
Try printing the value of documents.getLastError () After catching the offense exception.
Comments
Post a Comment