Skip to content

Commit

Permalink
fix #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyqus committed Nov 9, 2024
1 parent e99f945 commit 3dc47a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ooxml/XSSF/UserModel/XSSFWorkbook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions testcases/ooxml/XSSF/UserModel/TestCloneSheet.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
}
Binary file not shown.

0 comments on commit 3dc47a8

Please sign in to comment.