Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » OleFrame&OleClientSite for Excel
OleFrame&OleClientSite for Excel [message #987628] Tue, 27 November 2012 11:12 Go to next message
bogdan toma is currently offline bogdan tomaFriend
Messages: 39
Registered: February 2010
Member
Hello all,
i am opening excel files in my swt application; so i am using OleFrame& OleClientSite:
        this.frame = new OleFrame(this, SWT.NONE);
        this.clientSite = new OleClientSite(frame, SWT.NONE, "Excel.Sheet",
                file);
        this.clientSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);


Everyhting is ok, except the fact that the Excel displays a "Save" button (in quick access toolbar).
When this button is pressed the file is not saved.
The same way happens for the Eclipse Editor for "excel" files.
If I press the "Save" button inside excel nothing happens;
If I press the "Save" button on the eclipse toolbar the button is saved.

Is there any chance that I can do the save when "inside" button is pressed ?
Is there any chance to hide this button ?

I am using org.eclipse.swt_3.7.0.v3735b.jar & Office2010 (program ID = Excel.Sheet.12).

Thank you.
Re: OleFrame&OleClientSite for Excel [message #1027243 is a reply to message #987628] Tue, 26 March 2013 18:47 Go to previous message
Binko Binev is currently offline Binko BinevFriend
Messages: 20
Registered: June 2012
Junior Member
I do not think that it is possible. Because the embedded Excel workbook does not know where it is - it is just "Workbook in main".
Yet you can pass the file path as a custom document property for example, and call a macro on pressing the save button. I am not sure if there is an OLE event for saving the file to do that from the Java code.
In my app, I have icons in the main toolbat for save and save as, especially as Excel does not save correctly as PDF for tables with more columns than pass on a page (if it has page breaks, so I have to remove them).

Do you have also worked with Word.
My Word crtashes in this method


/**
	 * Returns the row in the table with the given index
	 * @param tableVar - table variant
	 * @param rowIndex - row index
	 * @return rowVariant - row Variant
	 * @throws OleException
	 */
	public static Variant getRow(Variant tableVar, int rowIndex) throws OleException {
		OleAutomation tableAuto = tableAuto = tableVar.getAutomation();
		OleUtils.printAutomation(tableAuto);
		Variant rowsVar = null;
		while (rowsVar == null){
			rowsVar = tableAuto.getProperty(101/*Rows*/);
		}
		OleAutomation rowsAuto = rowsVar.getAutomation();
		Variant rowVar = rowsAuto.invoke(0/*Item*/, new Variant[]{new Variant(rowIndex)});
		return rowVar;
	}



Sometimes it works for a large number of rows, some times it crashes - the rowIndex is arbitrary. I just do not know how to prevent it from crashing.

Any ideas?


Previous Topic:Confused about SWT OLE on 64-bit Windows
Next Topic:How to hide confirmConversion dialog when open docx file with help 2003
Goto Forum:
  


Current Time: Fri Apr 26 12:25:30 GMT 2024

Powered by FUDForum. Page generated in 1.74020 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top