Get individual cells inside a cell range

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Get individual cells inside a cell range

Pivithuru Wijegunawardana
Hi,
I need to get the individual cells inside a cell range. But I need to do
this without giving its x and y positions. Is there any method I could get a
XCell list from a cell range? I am doing this in java.

--
Best regards,
Pivithuru Wijegunawardana
University of Moratuwa
Sri Lanka
Reply | Threaded
Open this post in threaded view
|

Re: Get individual cells inside a cell range

Eike Rathke-6
Hi Pivithuru,

On Friday, 2010-08-06 14:01:31 +0530, Pivithuru Wijegunawardana wrote:

> I need to get the individual cells inside a cell range. But I need to do
> this without giving its x and y positions. Is there any method I could get a
> XCell list from a cell range? I am doing this in java.

You can query the XCellRangeAddressable interface and with that use
getRangeAddress() to obtain the CellRangeAddress and calculate the
dimensions
(nCols=cra.EndColumn-cra.StartColumn+1,nRows=cra.EndRow-cra.StartRow+1)
and then loop over all cells of the XCellRange from (0,0) < (nCols,nRows)
using getCellByPosition()

See
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Absolute_Address

  Eike

--
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 --
 Please don't send mail to the old [hidden email] account that I used for mailing
 lists, it will phase out shortly. Use [hidden email] instead. Thanks.

attachment0 (200 bytes) Download Attachment