View | Details | Raw Unified | Return to bug 55904
Collapse All | Expand All

(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (-1 / +12 lines)
Lines 626-635 Link Here
626
    public XSSFHyperlink getHyperlink(int row, int column) {
626
    public XSSFHyperlink getHyperlink(int row, int column) {
627
        String ref = new CellReference(row, column).formatAsString();
627
        String ref = new CellReference(row, column).formatAsString();
628
        for(XSSFHyperlink hyperlink : hyperlinks) {
628
        for(XSSFHyperlink hyperlink : hyperlinks) {
629
            if(hyperlink.getCellRef().equals(ref)) {
629
            String cellRef = hyperlink.getCellRef();
630
            if(cellRef.equals(ref)) {
630
                return hyperlink;
631
                return hyperlink;
632
            } else {
633
                // No suitable single-cell hyperlinks found, so multi-cell hyperlinks are scanned
634
                CellRangeAddress reference = CellRangeAddress.valueOf(hyperlink.getCellRef());
635
                if (row >= reference.getFirstRow()
636
                        && column >= reference.getFirstColumn()
637
                        && row <= reference.getLastRow()
638
                        && column <= reference.getLastColumn()) {
639
                    return hyperlink;
640
                }                
631
            }
641
            }
632
        }
642
        }
643
633
        return null;
644
        return null;
634
    }
645
    }
635
646

Return to bug 55904