Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] OLE capabilities in SWT

Hi Christopher,

1.b Enter a bug

1.c Can you create a OleAutomation using the constructor that takes a 
string ? Pass the progID as the parameter.
Once you get this object try to read the value for the property 
"ActiveDocument"
Something like this:
        OleAutomation automation = new OleAutomation("Excel.Sheet");
        int id = automation.getIDsOfNames(new String[] 
{"ActiveDocument"})[0];
        Variant variant = automation.getProperty(id);
        OleAutomation activeDocument = variant.getAutomation();
(100% untested)

VT_ARRAY 
Try the patch in the bugzilla  93652, prove the patch is correct and 
complete (I don't remember what is state of it).
Provide that the patch is good and doesn't break anything we should be 
able to include it for 3.7
(I'd do it myself but I'm really don't have time right now, sorry)

>Are there any plans to further improve OLE support in SWT?

Nothing at this moment. Personally I'd be more interested on .Net 
Controls, see:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=135775

Good luck
Felipe




From:
Christopher Deckers <chrriis@xxxxxxxxx>
To:
"Eclipse Platform SWT component developers list." 
<platform-swt-dev@xxxxxxxxxxx>
Date:
05/07/2010 01:38 PM
Subject:
[platform-swt-dev] OLE capabilities in SWT
Sent by:
platform-swt-dev-bounces@xxxxxxxxxxx



Hi,

First, this e-mail covers several aspects at once, some items one
might consider usage question.
Nevertheless, I am trying to figure out the state of things regarding
OLE in SWT so please bear with me.
I am inclined to open bug reports when something is clearly a
bug/limitation in SWT, and provide assistance with testing.

My test case is Excel 2010 on Windows 7.
I uploaded a test class along with a simple XLS file which shows the
results of my investigation: http://chrriis.free.fr/OleSWT.zip

Here is what I tried and the results:

1.a. Embed Excel inside an SWT UI.
=> OK

1.b. Launch the application and pilot it from code.
=> OleAutomation(String) seems to allow it but it fails.
=> It seems the only problem is a missing flag in the
OleAutomation(String) constructor. Copying some of OleAutomation code
and using a bit of reflection shows that it works.

1.c. Connect to a running instance.
=> API does not seem to allow it.
=> I failed to find a way to do it. I think it (simply?) needs a
native call to GetActiveObject(clsid, NULL, ppvObject).

2. Read and write data to a range.
=> API only allows it for ranges of one cell.
=> When more than one cell is needed, the result is a SafeArray and I
could not get it to work. There is an old bug (93652) and a snippet
(186) which I failed to adapt for this case.

3. Attach event listeners.
=> I only did a quick test and it seems to work.
=> Any known limitations?

As I could work aroung 1.b, I am mostly stuck with 1.c and 2. Any
known workarounds?
Should I open bug reports for 1.b and 1.c?
Can someone revive the SWT bug related to 2? Being able to read/write
ranges of data is critical when piloting Excel (I heard that the
Bloomberg ActiveX requires multi-dimensional arrays too so there are
definitely several important APIs using them).
Are there any plans to further improve OLE support in SWT?

Note that one of my goals related to OLE is to create a generic Java
interface generator which runtime implementation can be accomodated to
any COM bridge. I have a partial implementation for another COM bridge
but I am not convinced with the stability of that bridge and I think
SWT is not far from supporting all the necessary features. I am sure
such interface generator can be of interest to many OLE users so I
will probably publish it if I can get these features to work.

Thanks in advance,
-Christopher
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev





Back to the top