On 05/17/10 16:30, Qzi er wrote:
I can't understand the code below  , what's the deference between
"getByIndex( 0 )"   and  "*getByName( OUString::createFromAscii("Sheet2"));
*";

Just what the names suggest: getByIndex(0) returns the first sheet, getByName looks for a sheet with a specific name.

"XSpreadsheetDocument "  and "XSpreadsheets ";

See the pictures at http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Working_With_Spreadsheet_Documents for an overview of the services SpreadsheetDocument and Spreadsheets.

why I need use     Reference< XSpreadsheets > twice ?

        //query for a XSpreadsheetDocument interface
        Reference< XSpreadsheetDocument > rSheetDoc (xComponent, UNO_QUERY);

        //use it to get the XSpreadsheets interface
        Reference< XSpreadsheets > rSheets = rSheetDoc->getSheets();

        //query for the XIndexAccess interface
        Reference< XIndexAccess > xSheetsIA (rSheets, UNO_QUERY);
        Any sheet = xSheetsIA->getByIndex( 0 );
        Reference< XSpreadsheet > rSpSheet (sheet, UNO_QUERY);

If you mean the last line, it's XSpreadsheet, not XSpreadsheets.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to