Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353112 - Access to Office 2010 products via SWT.OLE fails if COM-Add-Ins are activated
Summary: Access to Office 2010 products via SWT.OLE fails if COM-Add-Ins are activated
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-26 10:00 EDT by Markus Kunde CLA
Modified: 2020-07-08 14:13 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kunde CLA 2011-07-26 10:00:02 EDT
Build Identifier: 20110615-0604

When trying to get access to, e.g., Excel 2010 via OLE strange errors occur when COM-Add-Ins are installed and activated. 
It is possible to open Excel as "Excel.Application", but it is not possible to add a new or open an existing workbook (load a file into it). This will result to a "null"-Variant after invoking "add" on the Excel application. 
Other programming languages, like Python, VB or Powershell, are working without any strange behavior.

I had posted a more detailed description in the Eclipse community forums: http://www.eclipse.org/forums/index.php/t/221747/



Reproducible: Always

Steps to Reproduce:
I'll just post my forum entry here:

Hi all,

I have a problem regarding OLE.

System (business laptop):
- Win 7 64bit (local Admin rights)
- Java 1.6.0.26 32bit
- Eclipse Indigo (SWT win32 x86: Version 3.7.0.v3735b)
- Office 2010 32bit

This is an example code. I just try to open Microsoft Excel, set visible to true and insert a new workbook. This fails and I cannot identify the reason for that. Maybe it is Java, SWT or a special configuration in Windows (in fact I have no idea because I potentially could exclude everything). The method-invoke "Add" returns a null, NO new workbook is displayed in Excel and in my code the following statements will fail because I need the workbook-object which is null.

The problem background:
- The same environment (JRE and Eclipse, SWT) on a clean Win 7 64bit and Office 32bit works (sounds like a Windows configuration failure). During debugging, I see that Excel opens and with invoking "add" a new workbook occurs.
- Other programming languages (Python with Win32 extensions, Powershell and Visual Basic) can perform the same code. In these languages invoking "add" produces a new visible workbook (sounds like a SWT-OLE or Java problem).

Anybody an idea?
Maybe it is just a security property on my business laptop (it works in other languages?) or maybe its a SWT problem?

Thanks for any ideas I can try.
Markus


Here is my example code (after null-pointer native Excel process will not killed):

private void workbookAdd() {
		Display display = new Display();
		Shell shell = new Shell(display);
		OleFrame frame = new OleFrame(shell, SWT.NONE);

		OleControlSite controlSite = new OleControlSite(frame, SWT.NONE, "Excel.Application");
		OleAutomation application = new OleAutomation(controlSite);
		controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);

		// Set visible
		Variant[] arguments = new Variant[1];
		arguments[0] = new Variant("true");
		int[] ids = application.getIDsOfNames(new String[] { "Visible" });
		application.setProperty(ids[0], arguments);

		// Get Workbooks-Object
		int[] excelIds = application.getIDsOfNames(new String[] { "Workbooks" });
		Variant workbooksVariant = application.getProperty(excelIds[0]);
		OleAutomation workbooks = workbooksVariant.getAutomation();
		
		// Add new workbook
		int idAdd = workbooks.getIDsOfNames(new String[] { "Add" })[0];
		Variant add = workbooks.invoke(idAdd);
		OleAutomation workbook = add.getAutomation();

		//some things I'd like to do with "workbook"-object.
		//...
		//...
		
		// Close Excel
		int invokeID = application.getIDsOfNames(new String[] { "Quit" })[0];
		application.invokeNoReply(invokeID);
	}
Comment 1 Markus Kunde CLA 2011-07-26 10:18:10 EDT
Maybe related to Issue 352511?
Comment 2 Eclipse Genie CLA 2020-07-08 14:13:31 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.