Example usage for org.apache.poi.hssf.usermodel HSSFHyperlink getLastRow

List of usage examples for org.apache.poi.hssf.usermodel HSSFHyperlink getLastRow

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFHyperlink getLastRow.

Prototype

@Override
public int getLastRow() 

Source Link

Document

Return the row of the last cell that contains the hyperlink

Usage

From source file:edu.ku.brc.specify.tasks.subpane.wb.XLSImport.java

License:Open Source License

/**
 * @param cell//from  w ww . jav a 2s .c  om
 * @param activeHyperlinks
 * @return the Hyperlink applicable for the cell.
 * 
 * NOTE: This code assumes that hyperlinks' row and column ranges do not overlap.   
 */
protected HSSFHyperlink checkHyperlinks(final HSSFCell cell, final Vector<HSSFHyperlink> activeHyperlinks) {
    if (cell.getHyperlink() != null) {
        HSSFHyperlink l = cell.getHyperlink();
        if (l.getLastRow() > cell.getRowIndex() || l.getLastColumn() > cell.getColumnIndex()) {
            activeHyperlinks.add(l);
        }
        return l;
    }

    for (HSSFHyperlink hl : activeHyperlinks) {
        if (cell.getRowIndex() >= hl.getFirstRow() && cell.getRowIndex() <= hl.getLastRow()
                && cell.getColumnIndex() >= hl.getFirstColumn()
                && cell.getColumnIndex() <= hl.getLastColumn()) {
            if (cell.getRowIndex() == hl.getLastRow()) {
                activeHyperlinks.remove(hl);
            }
            return hl;
        }
    }

    return null;
}