poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Andrews <pythonadd...@yahoo.com>
Subject RE: Can I access a cell with the excel cell index?
Date Wed, 09 Jul 2008 06:56:20 GMT
To deal with the merged region question firstly, it is possible to recover references to Region
objects that will allow you to work with the merged regions that exist on your worksheet.
Have a look at the getMergedRegions() and the getMergedRegionAt(int index) methods of the
HSSFSheet class. I have not had the need to use either but I am guessing that the former retunrs
an int value that idicates how many merged regions there are on the sheet and the latter allows
you to recover references to and information about each in turn. Then if you take a look at
the org.apache.poi.hssf.util.Region class, you will see that it contains methods that will
help you to identify if the cell is within a region, and others that return the numbers of
the top left hand cells row and column, but it will be up to you to implement the logic that
determines whether a cell is within a merged range and you have already dealt with the top
left hand cell of that range.

To determine if a cell is locked, you will need to recover the reference to the cells HSSFCellStyle
object and call the getLocked() method of that object. As far as I know, there is no way to
simply recover all of the the locked cells from the sheet. Instead, you will have to iterate
through all of the cells and simply check each to see if it is locked.

--- On Tue, 7/8/08, Ravi Sundaar <rsundaar@hotmail.com> wrote:
From: Ravi Sundaar <rsundaar@hotmail.com>
Subject: RE: Can I access a cell with the excel cell index?
To: user@poi.apache.org
Date: Tuesday, July 8, 2008, 1:36 PM

I need to retrieve the cell locations of unlocked cells in a worksheet. Of the
unlocked cells, some of of them are merged cells. I just need the first cell
for the merged cells.
Is there a way to find whether a cell is part of a merged cell?  If there a way
to identify only the unlocked/unprotected cells?
Thanks a lot for your response!
Use video conversation to talk face-to-face with Windows Live Messenger.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message