Open htoyama opened 2 months ago
2.7.0
Book1.xlsx
workbook.CloneSheet("Sheet1");
System.InvalidOperationException: 'The hyperlink for cell A1 references relation rId1, but that didn't exist!' RelationshipのIdは、コピー元のワークシートと同じにしないと例外になる。
diff --git a/ooxml/XSSF/UserModel/XSSFWorkbook.cs b/ooxml/XSSF/UserModel/XSSFWorkbook.cs index 2940dc72..da0981aa 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); } } }
NPOI Version
2.7.0
File Type
Upload the Excel File
Book1.xlsx
Reproduce Steps
workbook.CloneSheet("Sheet1");
Issue Description
System.InvalidOperationException: 'The hyperlink for cell A1 references relation rId1, but that didn't exist!' RelationshipのIdは、コピー元のワークシートと同じにしないと例外になる。