Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325304

Summary: Excel OLE is embedded as read-only, non-rich with no editor controls
Product: [Eclipse Project] Platform Reporter: Prafulla <prafulla.srinivasan>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
read-only non-rich UI none

Description Prafulla CLA 2010-09-14 23:25:24 EDT
Build Identifier: 20100617-1415

When I run Snippet199 from teh SWT examples list, the Excel object embedded in the frame is a read-only, non-rich version with no excel-editor menus. The background is gray, and selection is not possible.

Reproducible: Always

Steps to Reproduce:
1.Load Snippet199
2.Comment the OleAutomation and event listener section (I get an exception in OleAutomation.init when I run the entire snippet)
3.Run the resulting app. All it does is create an OLE Client and add it to the frame
Comment 1 Prafulla CLA 2010-09-14 23:28:14 EDT
Created attachment 178893 [details]
read-only non-rich UI
Comment 2 Olivier Thomann CLA 2010-09-15 08:11:09 EDT
Move to Platform/SWT
Comment 3 Felipe Heidrich CLA 2010-09-15 09:45:42 EDT
Snippet 199 works fine on my machine: windows xp + office 2003
Comment 4 Prafulla CLA 2010-09-15 10:28:36 EDT
(In reply to comment #3)
> Snippet 199 works fine on my machine: windows xp + office 2003

I have XP Professional version 2002, Service Pack 3 + office 2002. Excel embedded opens as a non-rich read-only as standalone applications, or in an RCP. Word/Explorer work well. 

Is there a registry key thats probably incorrect on my system? or a dll?
Comment 5 Prafulla CLA 2010-09-15 10:38:51 EDT
code:

public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());
    OleClientSite controlSite;
    try {
        OleFrame frame = new OleFrame(shell, SWT.NONE);
        File f = new File("C:/test123.xls");
        controlSite = new OleClientSite(frame, SWT.NONE, f);
        controlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
    } catch (SWTError e) {
        e.printStackTrace();
        System.out.println("Unable to open activeX control");
        display.dispose();
        return;
    }
    shell.open();

//    OleAutomation excelSheet = new OleAutomation(controlSite);
//    int[] dispIDs = excelSheet.getIDsOfNames(new String[] {"Application"});
//    Variant pVarResult = excelSheet.getProperty(dispIDs[0]);
//    OleAutomation application = pVarResult.getAutomation();
//    pVarResult.dispose();
//    excelSheet.dispose();
//    
//    int eventID = SheetSelectionChange;
//    OleListener listener = new OleListener() {
//        public void handleEvent (OleEvent e) {
//            System.out.println("selection has changed");
//            // two arguments which must be released (row and column)
//            Variant[] args = e.arguments;
//            for (int i = 0; i < args.length; i++) {
//                System.out.println(args[i]);
//                args [i].dispose();
//            }
//        }
//    };
//    controlSite.addEventListener(application, IID_AppEvents, eventID,
listener);

    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    //application.dispose();
    display.dispose ();
}

OleClient and OleControlSite give me the same readonly embedded objects. If I
leave the event-listner code uncommented, I get a null pointer exception on
"new OleAutomation(controlSite);" from the constructor. 

stacktrace:
Exception in thread "main" java.lang.NullPointerException
    at org.eclipse.swt.ole.win32.OleAutomation.<init>(OleAutomation.java:124)
    at com.hewitt.enabler.test.Snippet199.main(Snippet199.java:69)

Word/Explorer embed correctly, with no issues.
Comment 6 Eclipse Genie CLA 2018-12-30 12:07:58 EST
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.

If you have further information on the current state of the bug, please add it. 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.
Comment 7 Lars Vogel CLA 2019-09-02 14:54:16 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.