diff --git a/ooxml/XSSF/UserModel/XSSFWorkbook.cs b/ooxml/XSSF/UserModel/XSSFWorkbook.cs index 2940dc72f..da0981aa7 100644 --- a/ooxml/XSSF/UserModel/XSSFWorkbook.cs +++ b/ooxml/XSSF/UserModel/XSSFWorkbook.cs @@ -626,7 +626,7 @@ public ISheet CloneSheet(int sheetNum, String newName) if (pr.TargetMode == TargetMode.External) { clonedSheet.GetPackagePart().AddExternalRelationship - (pr.TargetUri.OriginalString, pr.RelationshipType, null); + (pr.TargetUri.OriginalString, pr.RelationshipType, pr.Id); } } } diff --git a/testcases/ooxml/XSSF/UserModel/TestCloneSheet.cs b/testcases/ooxml/XSSF/UserModel/TestCloneSheet.cs new file mode 100644 index 000000000..c04c77af9 --- /dev/null +++ b/testcases/ooxml/XSSF/UserModel/TestCloneSheet.cs @@ -0,0 +1,18 @@ +using NUnit.Framework; +using System.IO; + +namespace NPOI.XSSF.UserModel +{ + [TestFixture] + public class TestCloneSheet + { + [Test] + public void TestCloneHyperlink() + { + using(var workbook = XSSFTestDataSamples.OpenSampleWorkbook("1370_clonesheet_withhyperlink.xlsx")) + { + workbook.CloneSheet(0,"Sheet2"); + } + } + } +} \ No newline at end of file diff --git a/testcases/test-data/spreadsheet/1370_clonesheet_withhyperlink.xlsx b/testcases/test-data/spreadsheet/1370_clonesheet_withhyperlink.xlsx new file mode 100644 index 000000000..082bb7d45 Binary files /dev/null and b/testcases/test-data/spreadsheet/1370_clonesheet_withhyperlink.xlsx differ