]> source.dussan.org Git - poi.git/commitdiff
[bug-66212] try to remove package part for table when removing table
authorPJ Fanning <fanningpj@apache.org>
Sat, 13 Aug 2022 15:32:03 +0000 (15:32 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 13 Aug 2022 15:32:03 +0000 (15:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903394 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
src/resources/ooxml-lite-report.clazz

index 83aa926529f85ba96b9799c92c4dcfc5216f3302..1459bc872d1c79efcb2fa7da9d875c42f6367428 100644 (file)
@@ -36,10 +36,7 @@ import org.apache.poi.ooxml.POIXMLDocumentPart;
 import org.apache.poi.ooxml.POIXMLException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException;
-import org.apache.poi.openxml4j.opc.PackagePart;
-import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
-import org.apache.poi.openxml4j.opc.TargetMode;
+import org.apache.poi.openxml4j.opc.*;
 import org.apache.poi.poifs.crypt.HashAlgorithm;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.formula.FormulaShifter;
@@ -4315,6 +4312,11 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
             removeRelation(getRelationById(toDelete.getKey()), true);
             tables.remove(toDelete.getKey());
             toDelete.getValue().onTableDelete();
+            OPCPackage opcPackage = getWorkbook().getPackage();
+            PackagePart packagePart = t.getPackagePart();
+            if (packagePart != null && opcPackage.containPart(packagePart.getPartName())) {
+                opcPackage.removePart(packagePart);
+            }
         }
     }
 
index a8fb87693f33dc9ee2af2bb6bad7bb552fea7813..811deff38aa650178b3527dd8bfcea8cf6895757 100644 (file)
@@ -2504,3 +2504,12 @@ com/microsoft/schemas/office/drawing/x2008/diagram/CTGroupShapeNonVisual
 com/microsoft/schemas/office/drawing/x2008/diagram/impl/CTShapeImpl
 com/microsoft/schemas/office/drawing/x2008/diagram/impl/CTShapeNonVisualImpl
 com/microsoft/schemas/office/drawing/x2008/diagram/CTShapeNonVisual
+org/openxmlformats/schemas/drawingml/x2006/chart/impl/CTBubbleChartImpl
+org/openxmlformats/schemas/drawingml/x2006/chart/CTBubbleChart
+org/openxmlformats/schemas/drawingml/x2006/chart/CTBubbleSer
+org/openxmlformats/schemas/drawingml/x2006/chart/impl/CTBubbleSerImpl
+org/openxmlformats/schemas/drawingml/x2006/chart/impl/CTDLblPosImpl
+org/openxmlformats/schemas/drawingml/x2006/chart/CTDLblPos
+org/openxmlformats/schemas/drawingml/x2006/chart/STDLblPos$Enum
+org/openxmlformats/schemas/drawingml/x2006/chart/impl/STDLblPosImpl
+org/openxmlformats/schemas/drawingml/x2006/chart/STDLblPos