Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problem with OLE automation and Microsof Excel
Problem with OLE automation and Microsof Excel [message #453205] Thu, 31 March 2005 18:36 Go to next message
Boris Munivrana is currently offline Boris MunivranaFriend
Messages: 23
Registered: July 2009
Junior Member
Hi there,

I’m using swt.ole.win32 to take advantage of the COM-interfaces for
Office apps MSWord and MSExcel (Note: I have Office 2000 installed,
running on Windows 2000 Professional, Service Pack 3).

What I’m basically doing is writing data from a SWT.Table into a new Word
document (creating a table there) and, of course, into a new Excel
workbook.
With MSWord, everything works like a charm, but MSExcel causes a problem:

When Excel is closed after the operation (writing the data), there still
remains an EXCEL-background process, as one can see switching to the
Windows Taskmanager’s “Processes” tab, and can only be “killed” via the
“End Process”-Menu of the taskmanager.
All this happens even if I dispose all instances of my OleAutomation. In
opposition to that, MSWord REALLY quits after closing the application.

I made a benchmark test using Visual Basic, just to see if Excel behaves
the same way being called remotely, but no, everything worked fine.

Please also note: For MSWord, I make use of “Word.Application” as the
OleClientSite’s program id, as it is also used in Visual Basic (see
CreateObject(“Word.Application”)).
Everything works fine.
Making use of “Excel.Application” with SWT, the processor load rises up to
a 100% and remains at that level, hence I’m using “Excel.Sheet” as progid,
but
still there’s the problem with a remaining background process (Note:
closing Excel with it's "End"-Menu or invoking the "Quit"-Method remotely
via DispatchInterface doesn't make any difference).

Has anybody else made use of MSExcel within his SWT application, and had
an issue with that?
Any help would be appreciated!!!

Thanks,

Boris Munivrana
Re: Problem with OLE automation and Microsof Excel [message #453237 is a reply to message #453205] Fri, 01 April 2005 15:14 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Please enter a bug report against Platform SWT.

"Boris Munivrana" <bmunivrana@web.de> wrote in message
news:af2316230857f5ac4c8d4c966a9d11de$1@www.eclipse.org...
> Hi there,
>
> I
Re: Problem with OLE automation and Microsof Excel [message #453243 is a reply to message #453205] Fri, 01 April 2005 18:53 Go to previous messageGo to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
<br><font size=1 face="sans-serif">I don't know if it relevant but I was doing a similar thing with Excel using jacozoom.</font>
<br>
<br><font size=1 face="sans-serif">I was connecting to Excel, then adding a workbook and then a sheet.</font>
<br>
<br><font size=1 face="sans-serif">I found releasing Excel did not in fact release the workbook or sheet, I ended up having to explicitly let go of them all</font>
<br>
<br><font size=1 face="sans-serif">It left Excel showing in the task manager process view and had to be killed.</font>
<br>
<br><font size=1 face="sans-serif">start up was</font>
<br>
<br><font size=1 face="sans-serif">excel = Excel97.getInstance(true);</font>
<br><font size=1 face="sans-serif">workbook = excel.getWorkbooks().add();</font>
<br><font size=1 face="sans-serif">sheet = Worksheet.getWorksheetFromUnknown(workbook.getWorksheets().a dd()); </font>
<br><font size=1 face="sans-serif">excel.setVisible(true);</font>
<br><font size=1 face="sans-serif">excel.setWindowState(-4140);</font>
<br>
<br><font size=1 face="sans-serif">and to close</font>
<br>
<br><font size=1 face="sans-serif">public void close() {</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sheet.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; workbook.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Excel97.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; }</font>
<br>
<br><font size=1 face="sans-serif">just letting go of excel did not shut down the ole connection.</font>
<br>
<br><font size=1 face="sans-serif">never done ole in eclipse so don't know what the equivalent of release is.</font>
Re: Problem with OLE automation and Microsof Excel [message #453244 is a reply to message #453237] Fri, 01 April 2005 18:58 Go to previous messageGo to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
<br><font size=1 face="sans-serif">I don't know how relevant this is to eclipse but I have has a similar problem with Excel using jacozoom.</font>
<br>
<br><font size=1 face="sans-serif">I start up something like this</font>
<br>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; excel = Excel97.getInstance(true);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; workbook = excel.getWorkbooks().add();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; sheet = Worksheet.getWorksheetFromUnknown(workbook.getWorksheets().a dd()); </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; excel.setVisible(true);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; excel.setWindowState(-4140);</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; String id = textList.getId();</font>
<br>
<br><font size=1 face="sans-serif">if I do an excel.release() I end up wit Excel running as a hidden process which I have to kill with task manager</font>
<br>
<br><font size=1 face="sans-serif">i ended up having to release the three components</font>
<br>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; public void close() {</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; sheet.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; workbook.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Excel97.release();</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; }</font>
<br>
<br><font size=1 face="sans-serif">Then excel would die when it was exited.</font>
<br>
<br><font size=1 face="sans-serif">I have never done ole programming in eclipse but it sounded so similar</font>
<br>
<br><font size=1 face="sans-serif">try disposing of the sheet, the workbook and excel.</font>
Re: Problem with OLE automation and Microsof Excel [message #453253 is a reply to message #453243] Sat, 02 April 2005 16:57 Go to previous message
Boris Munivrana is currently offline Boris MunivranaFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,Phill,

sounds like a similiar issue, but as opposed to what you describe, I
cannot release the Excel process even if I do dispose all of my automation
objects (= Sheet, Workbook, etc.) EXPLICITLY.
I made a bug report, and hope that this will be fixed soon, since Excel is
one of the most important business software, and OLE automation and Excel
seem to be far from consistent in SWT.

Regards
Previous Topic:Unselectable nodes in TableTreeView
Next Topic:AbstractTreeViewer.add method performance.
Goto Forum:
  


Current Time: Fri Mar 29 02:19:11 GMT 2024

Powered by FUDForum. Page generated in 0.02934 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top