Talk:Documentation/DevGuide/Spreadsheets/Example: Adding a New Spreadsheet

From Apache OpenOffice Wiki
Jump to: navigation, search

In the insertSpreadsheet() method of the example, the assignement

xSheet = xSheets.getByName(aName);

cannot be casted to as per Exception reported as follow:

java.lang.ClassCastException: cannot be cast to

As per the API, the method getByName returns as data type.

I think it should:

xSheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, xSheets.getByName(aName));

I'm using Netbeans 6.7.1 with API Plugin v.2.0.6, the SDK is 3.1.1

--Javacioc 22:13, 15 November 2009 (UTC)

yes, this is wrong in the code snippet but correct in the SDK sample. I have changed the code snippet!

--Jsc 14:54, 18 November 2009 (UTC)

Personal tools