From 49297979bb7d15838f18d8625c02d2c8738d7809 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Tue, 30 Dec 2008 09:24:15 +0000 Subject: [PATCH] move hyperlinks when shifting rows git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@730076 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/HSSFSheet.java | 6 +++ .../org/apache/poi/hssf/data/46445.xls | Bin 0 -> 17408 bytes .../apache/poi/hssf/usermodel/TestBugs.java | 24 ++++++++++ .../poi/hssf/usermodel/TestHSSFHyperlink.java | 45 ++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100755 src/testcases/org/apache/poi/hssf/data/46445.xls diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index ac8405946..9ed29e00f 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -1187,6 +1187,12 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { cellRecord.setRow( rowNum + n ); row2Replace.createCellFromRecord( cellRecord ); sheet.addValueRecord( rowNum + n, cellRecord ); + + HSSFHyperlink link = cell.getHyperlink(); + if(link != null){ + link.setFirstRow(link.getFirstRow() + n); + link.setLastRow(link.getLastRow() + n); + } } // Now zap all the cells in the source row row.removeAllCells(); diff --git a/src/testcases/org/apache/poi/hssf/data/46445.xls b/src/testcases/org/apache/poi/hssf/data/46445.xls new file mode 100755 index 0000000000000000000000000000000000000000..30aaf343ada7a2893036f585dbe656849a08490f GIT binary patch literal 17408 zcmeHPU2I%O75?seH(uLu{GT{~o7;6z94E0-OKmKy);3A2xJjsSS{kU!;>MeLvE!}Q z8%Pj{ZAm2_f>hKBULv7NEi_5hf{*}(3MFquqBKIPDi9Jb3NH}?fr`|iw&wfJ-Ru4F zZg4{iN_5ZW%*;J=X3m*&=gysT?l_m@F~+_!jTRaIPv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