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


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,