Sorry it took so long to respond but XSSF - and I am assuming you are
targeting OpenXML workbooks and using that stream of the API - is not really
my area so I had to dig around a little. Further, I have not tested this
code so cannot promise it will work but it should;
int numNames = workbook.getNumberOfNames();
for(int i = 0; i < numNames; i++) {
XSSFName name = workbook.getNameAt(i);
System.out.println("Name: " + name.getNameName());
System.out.println("Formula: " + name.getRefersToFormula());
System.out.println("Index: " + name.getSheetIndex());
System.out.println("Sheet name: " + name.getSheetName());
}
With regard to HSSFWorkbooks, more of this is defined directly at the sheet
level - for example there is an HSSFWorkbook.getNameName(index) method. In
addition, the HSSF stream does have an analogue for the XSSFName class
called HSSFName. As far as I know, it has all of the same methods declared.
Hope this helps.
Yours
Mark B
Bober, Paul wrote:
>
> Thanks, but I'm looking for an XSSFName (a cell range alias), not the name
> of a sheet.
>
> -----Original Message-----
> From: Mahesh Ganapathy [mailto:[email protected]]
> Sent: Wednesday, August 19, 2009 4:21 PM
> To: POI Users List
> Subject: Re: getName() for local worksheet names
>
> You should have getSheetName on workbook.
> Sent via BlackBerry by AT&T
>
> -----Original Message-----
> From: "Bober, Paul" <[email protected]>
>
> Date: Wed, 19 Aug 2009 16:18:19
> To: <[email protected]>
> Subject: getName() for local worksheet names
>
>
> How do you retrieve names that are local to an individual worksheet?
> There are methods getName() and getNameIndex() on Workbook but neither
> take a Sheet parameter. Moreover, there is no getName() on Sheet. The
> existing methods seem suitable for retrieving only global names.
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/getName%28%29-for-local-worksheet-names-tp25053506p25074874.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]