Re: [dev] question about sheet ?
Good Job ! Niklas ! On Mon, May 17, 2010 at 11:52 PM, Niklas Nebel wrote: > 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_Documentsfor > 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 > > -- 作智慧的减法 ... 体会生活的微妙的富足 ... 嗯 ...
Re: [dev] question about sheet ?
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
[dev] question about sheet ?
I can't understand the code below , what's the deference between "getByIndex( 0 )" and "*getByName( OUString::createFromAscii("Sheet2")); *"; "XSpreadsheetDocument " and "XSpreadsheets "; 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); -- 作智慧的减法 ... 体会生活的微妙的富足 ... 嗯 ...