for(int m=0;m<sheet.getNumMergedRegions();m++){
              Region region=sheet.getMergedRegionAt(m);
                  // +1 is required as both ends of range are inclusive
              int numCols=region.getColumnTo()-region.getColumnFrom()+1;
              int numRows=region.getRowTo()-region.getRowFrom()+1;
                  ....  
            }
Regards,
Tahir Akhtar
-----Original Message-----
From: Karr, David [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 08, 2007 11:38 PM
To: [email protected]
Subject: How to read single value from merged cells

I haven't used POI in a long time, and I need to throw something
together pretty quickly to read specific data out of a somewhat
complicated spreadsheet.

In the spreadsheet, I'm going to need to read a value from each of many
merged cell blocks.  When I view the sheet in Excel, the value is at the
top of the merged cell range.  The cells after the cell in the range
that has the value are all blank.  If I have to, I can hardcode the
starting cell number and the "length" of the range, but it would be
great if POI can tell me how large the range is that the cell is in.  I
would like to know this because the next read I have to do is in the
cell range that comes right after the first one (and so on).

What classes/methods in POI can help me with this?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to