[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Display Excel in full screen mode

This works for me. It's basically the same as what you mentioned.

/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     IBM Corporation - initial API and implementation
*******************************************************************************/
package swt.examples.ole;

import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.ole.win32.*;
import org.eclipse.swt.widgets.*;

/*
* Open an OLE Excel sheet.
*
* For a list of all SWT example snippets see
* http://www.eclipse.org/swt/snippets/
* * @since 3.3
*/ public class ExcelFullScreen {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Excel Example");
shell.setLayout(new FillLayout());
OleClientSite clientSite = null;
try {
OleFrame frame = new OleFrame(shell, SWT.NONE);
clientSite = new OleClientSite(frame, SWT.NONE, "Excel.Sheet");
OleAutomation sheet = new OleAutomation(clientSite);
OleAutomation application = getAutoProperty(sheet, "Application");
setProperty(application, "DisplayFullScreen", new Variant(true));
} catch (SWTError e) {
System.out.println("Unable to open activeX control");
return;
}
shell.setSize(800, 600);
shell.open();

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

// These helper methods facilitate writing the OLE apps
private static boolean setProperty(OleAutomation auto, String name,
Variant value) {
return auto.setProperty(property(auto, name), value);
}


	private static int property(OleAutomation auto, String name) {
		return auto.getIDsOfNames(new String[] { name })[0];
	}

private static OleAutomation getAutoProperty(OleAutomation auto, String name) {
Variant varResult = auto.getProperty(property(auto, name));
if (varResult != null && varResult.getType() != OLE.VT_EMPTY) {
OleAutomation result = varResult.getAutomation();
varResult.dispose();
return result;
}
return null;
}
}



Sajid wrote:

Hi All,

Does anybody has an idea how to hide Ribbons (new toolbars at the top) through OleAutomation. I tried it hard but couldnt achieve. I tried to at-least show in a full screen but no success
........
........
int[] rgdispid = application.getIDsOfNames(new String[]{"DisplayFullScreen"});
int dispIdMember = rgdispid[0];
Variant[] rgvarg = new Variant[1];
rgvarg[0] = new Variant(true);
boolean isX = application.setProperty(dispIdMember, rgvarg);
........
........

Can anybody help?

Regards