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

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

Introduction

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

Prototype

@Override
public int getLastColumn() 

Source Link

Document

Return the column 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//  w w w  .j  a  v a  2 s .  c  o m
 * @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;
}