Are you looking at the correct class? The one I referred to is the
org.apache.poi.ss.util.CellRangeAddress class. It extends the
CellRangeAddressBase class and inherits the isInRange(int, int) method from
that.

With regard to making the comparison, all you need to do is pass the row and
column numbers of the cell to the isInRange() method for a CellRangeAddress
object you have recovered from the array. You may know the address of the
cell - depending on the code you are using to recover cells from your
worksheets - but if not can recover it by calling the getRowIndex() and
getColumnIndex() method on the cell object.

Yours

Mark B


pb2208 wrote:
> 
> Interestng.  The documentation appears to indicate that "CellRangeAddress"
> object is depricated.
> http://poi.apache.org/apidocs/org/apache/poi/hssf/util/CellRangeAddress.html
> 
> I have written the code and have a question on the "isInRange" method. 
> Where is it defined and how can it compare the values in the array?
> 
> 
> MSB wrote:
>> 
>> I do not have the code to hand but the technique that I have used in the
>> past goes like this.
>> 
>> Open the worksheet.
>> Call the getNumMergedRegions() methods to recover an integer that
>> indicates how manymerged regions there are on the sheet.
>> Use this value to create and dimension an array of type CellRangeAddress.
>> Use this value again to iterate through all of the merged regions - use a
>> for() loop - calling the getMergedRegion(int) method and storing the
>> returned CellRangeAdress object into the array.
>> 
>> Now when you encounter a cell, you can iterate through the objects in the
>> cell range address array and call the isInGange(int, int) method passing
>> the row and column indeices of the cell. That will return a boolean value
>> indicating whether or not the cell is contained within the range.
>> 
>> Yours
>> 
>> Mark B
>> 
>> 
>> pb2208 wrote:
>>> 
>>> I am parsing a spreadsheet and need to skip processing for an merged
>>> cells.  How can i test a cell to see if it is part of merged set of
>>> cells?
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Testing-for-Merged-cells-tp28811936p28818844.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]

Reply via email to