Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » OleClientSite Trouble with Excel(OleClientSite does not embed an Excel as in-place correctly.)
OleClientSite Trouble with Excel [message #650630] Tue, 25 January 2011 13:58 Go to next message
Phil M. Fischer is currently offline Phil M. Fischer
Messages: 60
Registered: November 2010
Location: Germany
Member
Hello Everyone,

I am currently developing an Eclipse RCP App including an editor that has to embed an Excel application as in-place editor. I am using the OLE facilities from SWT. In detail I am using the OleControlSite referencing to a xls-file in order to open the Excel instance. In general things look fine Smile but I am facing the following problems Confused :

1. Looking to MSDN and other sources, I understand that if trigerring the doVerb(OLE.OLEIVERB_INPLACEACTIVATE) Excel should show up not messing around with the menus of the RCP until the user gives the focus to the Excel client. As soon as the client looses focus the RCP menus should get back to normal, but they don't. Confused Is this a bug? Or is it just me not understanding some bits?

2. To overcome the first problem, I added a FocusListener to the OleControlSite, to do the doVerb(OLE.OLEIVERB_INPLACEACTIVATE) as soon as excel gets the focus, and to call deactivateInPlaceClient() as soon as it looses focus. Doing this I am fine with my RCP Menus and the Excel menus' mixins. Smile Unfortunately now, calling the deactivateInPlaceClient(), will stop rendering the Excel application correctly and it just shows the "A1" cell stretched to the size of the OleFrame. Crying or Very Sad

Does anyone know how to get around theses Issues. I am currently trying to activate and deactivate the Excel's "CommandBars" together with the FocusListener but firstly it is not a beautiful approach, secondly I don't even know if it will work.

Cheers

Phil
Re: OleClientSite Trouble with Excel [message #650756 is a reply to message #650630] Wed, 26 January 2011 07:35 Go to previous message
Phil M. Fischer is currently offline Phil M. Fischer
Messages: 60
Registered: November 2010
Location: Germany
Member
Hi there,

DIgging through the code of OLE and eclipse if ound two moderate solutions to my Problem Confused :

First Solution is:
Set the RCP's MenuBar to null by using getShell().setMenuBar(null) befor activating the oleControlSite. And after that set the MenuBar back to what it has been before. This prevents the OleFrame from doing anything with the RCP's MenuBar because it assumes it does not exist.

Second Solution is:
Use OS.SetMenu(shellHandle, menubar.handle); to set back the RCP's MenuBar.

Still this is a workaround, And I am not fully convinced with this solution. Anyway it works for the moment. Other Ideas and thoughts are still welcome. Smile

Cheers

Phil
Previous Topic:How to hide Excel toolbars using SWT
Next Topic:Failed to create Ole Client.
Goto Forum:
  


Current Time: Mon Sep 01 03:46:10 EDT 2014

Powered by FUDForum. Page generated in 0.01591 seconds