]> source.dussan.org Git - poi.git/commitdiff
[github-264] bug in link external workbook. This closes #264
authorPJ Fanning <fanningpj@apache.org>
Fri, 15 Oct 2021 07:40:29 +0000 (07:40 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 15 Oct 2021 07:40:29 +0000 (07:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894275 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java

index b61cd50129af3577f5ddc6efe71dfbd0dbfdc5f8..2b67475b0beb33376ab14ad149d97ead7117f703 100644 (file)
@@ -1994,7 +1994,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
         int externalLinkIdx=-1;
         if (!getCreationHelper().getReferencedWorkbooks().containsKey(name)){
              externalLinkIdx = this.getNextPartNumber(XSSFRelation.EXTERNAL_LINKS,
-                    this.getPackagePart().getPackage().getPartsByContentType(XSSFRelation.EXTERNAL_LINKS.getContentType()).size());
+                    this.getPackagePart().getPackage().getPartsByContentType(XSSFRelation.EXTERNAL_LINKS.getContentType()).size() + 1);
             POIXMLDocumentPart.RelationPart rp = this.createRelationship(XSSFRelation.EXTERNAL_LINKS, xssfFactory, externalLinkIdx, false);
             ExternalLinksTable linksTable = rp.getDocumentPart();
             linksTable.setLinkedFileName(name);