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

(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (-2 / +16 lines)
Lines 819-829 Link Here
819
     */
819
     */
820
    @Override
820
    @Override
821
    public XSSFHyperlink getHyperlink(CellAddress addr) {
821
    public XSSFHyperlink getHyperlink(CellAddress addr) {
822
        String ref = addr.formatAsString();
822
        // find single-cell hyperlink at addr
823
        final String ref = addr.formatAsString();
824
        final int row = addr.getRow();
825
        final int column = addr.getColumn();
823
        for(XSSFHyperlink hyperlink : hyperlinks) {
826
        for(XSSFHyperlink hyperlink : hyperlinks) {
824
            if(hyperlink.getCellRef().equals(ref)) {
827
            final String hyperRef = hyperlink.getCellRef();
828
            
829
            // check if single-cell hyperlink
830
            if (hyperRef.equals(ref)) {
825
                return hyperlink;
831
                return hyperlink;
826
            }
832
            }
833
            
834
            // check if multi-cell hyperlink
835
            else if (hyperRef.contains(":")) {
836
                final CellRangeAddress area = CellRangeAddress.valueOf(hyperRef);
837
                if (area.isInRange(row, column)) {
838
                    return hyperlink;
839
                }
840
            }
827
        }
841
        }
828
        return null;
842
        return null;
829
    }
843
    }

Return to bug 55904