From 4446d86812d9fec851085fc406dc4571aab6a3c8 Mon Sep 17 00:00:00 2001 From: Gan Keyu Date: Sat, 12 Aug 2023 13:27:04 +0800 Subject: [PATCH 1/2] remove reflections in xssf docpart creation --- .../UserModel/DocumentPartCreationHelper.cs | 262 ++++++++++++++++++ ooxml/XSSF/UserModel/XSSFChart.cs | 2 + ooxml/XSSF/UserModel/XSSFChartSheet.cs | 3 + ooxml/XSSF/UserModel/XSSFFactory.cs | 17 +- ooxml/XSSF/UserModel/XSSFPivotCache.cs | 2 + .../UserModel/XSSFPivotCacheDefinition.cs | 2 + ooxml/XSSF/UserModel/XSSFPivotCacheRecords.cs | 2 + ooxml/XSSF/UserModel/XSSFPivotTable.cs | 2 + ooxml/XSSF/UserModel/XSSFVMLDrawing.cs | 3 + ooxml/XWPF/Usermodel/XWPFFactory.cs | 18 +- ooxml/XWPF/Usermodel/XWPFPictureData.cs | 2 + 11 files changed, 285 insertions(+), 30 deletions(-) create mode 100644 ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs diff --git a/ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs b/ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs new file mode 100644 index 000000000..3ea8b64f5 --- /dev/null +++ b/ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs @@ -0,0 +1,262 @@ +/* + * ==================================================================== + * Licensed to the collaborators of the NPOI project under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The collaborators licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ +using NPOI.OpenXml4Net.OPC; +using NPOI.XSSF.Model; +using NPOI.XWPF.UserModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NPOI.XSSF.UserModel +{ + internal static class DocumentPartCreationHelper + { + public static POIXMLDocumentPart CreateDocumentPart(Type cls, Type[] types, Object[] values) + { + if ((values is null || values.Length == 0) && (types is null || types.Length == 0)) + { + return CreateDocumentPartParamless(cls); + } + + if (values.Length == 1 && types.Length == 1 && types[0] == typeof(PackagePart)) + { + return CreateDocumentPartOneParam(cls, (PackagePart)values[0]); + } + + if (values.Length == 2 && types.Length == 2 && types[0] == typeof(POIXMLDocumentPart) && types[1] == typeof(PackagePart)) + { + return CreateDocumentPartTwoParams(cls, (POIXMLDocumentPart)values[0], (PackagePart)values[1]); + } + + ThrowHelper_MissingMethod(); + return null; + } + + private static void ThrowHelper_MissingMethod() + { + throw new MissingMethodException(); + } + private static POIXMLDocumentPart CreateDocumentPartParamless(Type cls) + { + if (cls == typeof(XWPFDocument)) + return new XWPFDocument(); + if (cls == typeof(XSSFWorkbook)) + return new XSSFWorkbook(); + if (cls == typeof(XWPFComments)) + return new XWPFComments(); + if (cls == typeof(XWPFFootnotes)) + return new XWPFFootnotes(); + if (cls == typeof(XWPFFooter)) + return new XWPFFooter(); + if (cls == typeof(XWPFHeader)) + return new XWPFHeader(); + if (cls == typeof(XWPFNumbering)) + return new XWPFNumbering(); + if (cls == typeof(XWPFPictureData)) + return XWPFPictureData.InternalCreateInstance(); + if (cls == typeof(XWPFSettings)) + return new XWPFSettings(); + if (cls == typeof(XWPFStyles)) + return new XWPFStyles(); + if (cls == typeof(XSSFChart)) + return new XSSFChart(); + if (cls == typeof(XSSFDrawing)) + return new XSSFDrawing(); + if (cls == typeof(XSSFPictureData)) + return new XSSFPictureData(); + if (cls == typeof(XSSFPivotCache)) + return new XSSFPivotCache(); + if (cls == typeof(XSSFPivotCacheDefinition)) + return new XSSFPivotCacheDefinition(); + if (cls == typeof(XSSFPivotCacheRecords)) + return new XSSFPivotCacheRecords(); + if (cls == typeof(XSSFPivotTable)) + return new XSSFPivotTable(); + if (cls == typeof(XSSFSheet)) + return new XSSFSheet(); + //if (cls == typeof(XSSFChartSheet)) + //return new XSSFChartSheet(); + //if (cls == typeof(XSSFDialogsheet)) + //return new XSSFDialogsheet(); + if (cls == typeof(XSSFTable)) + return new XSSFTable(); + if (cls == typeof(XSSFVBAPart)) + return new XSSFVBAPart(); + if (cls == typeof(XSSFVMLDrawing)) + return new XSSFVMLDrawing(); + if (cls == typeof(CalculationChain)) + return new CalculationChain(); + if (cls == typeof(CommentsTable)) + return new CommentsTable(); + if (cls == typeof(ExternalLinksTable)) + return new ExternalLinksTable(); + if (cls == typeof(MapInfo)) + return new MapInfo(); + if (cls == typeof(SharedStringsTable)) + return new SharedStringsTable(); + if (cls == typeof(SingleXmlCells)) + return new SingleXmlCells(); + if (cls == typeof(StylesTable)) + return new StylesTable(); + if (cls == typeof(ThemesTable)) + return new ThemesTable(); + + ThrowHelper_MissingMethod(); + return null; + } + private static POIXMLDocumentPart CreateDocumentPartOneParam(Type cls, PackagePart part) + { + //if (cls == typeof(XWPFDocument)) + //return new XWPFDocument(part); + //if (cls == typeof(XSSFWorkbook)) + //return new XSSFWorkbook(part); + //if (cls == typeof(XWPFComments)) + //return new XWPFComments(part); + if (cls == typeof(XWPFFootnotes)) + return new XWPFFootnotes(part); + //if (cls == typeof(XWPFFooter)) + //return new XWPFFooter(part); + //if (cls == typeof(XWPFHeader)) + //return new XWPFHeader(part); + if (cls == typeof(XWPFNumbering)) + return new XWPFNumbering(part); + if (cls == typeof(XWPFPictureData)) + return new XWPFPictureData(part); + if (cls == typeof(XWPFSettings)) + return new XWPFSettings(part); + if (cls == typeof(XWPFStyles)) + return new XWPFStyles(part); + if (cls == typeof(XSSFChart)) + return XSSFChart.InternalCreateInstance(part); + if (cls == typeof(XSSFDrawing)) + return new XSSFDrawing(part); + if (cls == typeof(XSSFPictureData)) + return new XSSFPictureData(part); + if (cls == typeof(XSSFPivotCache)) + return XSSFPivotCache.InternalCreateInstance(part); + if (cls == typeof(XSSFPivotCacheDefinition)) + return XSSFPivotCacheDefinition.InternalCreateInstance(part); + if (cls == typeof(XSSFPivotCacheRecords)) + return XSSFPivotCacheRecords.InternalCreateInstance(part); + if (cls == typeof(XSSFPivotTable)) + return XSSFPivotTable.InternalCreateInstance(part); + if (cls == typeof(XSSFSheet)) + return new XSSFSheet(part); + if (cls == typeof(XSSFChartSheet)) + return XSSFChartSheet.InternalCreateInstance(part); + //if (cls == typeof(XSSFDialogsheet)) + //return new XSSFDialogsheet(part); + if (cls == typeof(XSSFTable)) + return new XSSFTable(part); + if (cls == typeof(XSSFVBAPart)) + return new XSSFVBAPart(part); + if (cls == typeof(XSSFVMLDrawing)) + return XSSFVMLDrawing.InternalCreateInstance(part); + if (cls == typeof(CalculationChain)) + return new CalculationChain(part); + if (cls == typeof(CommentsTable)) + return new CommentsTable(part); + if (cls == typeof(ExternalLinksTable)) + return new ExternalLinksTable(part); + if (cls == typeof(MapInfo)) + return new MapInfo(part); + if (cls == typeof(SharedStringsTable)) + return new SharedStringsTable(part); + if (cls == typeof(SingleXmlCells)) + return new SingleXmlCells(part); + if (cls == typeof(StylesTable)) + return new StylesTable(part); + if (cls == typeof(ThemesTable)) + return new ThemesTable(part); + + ThrowHelper_MissingMethod(); + return null; + } + private static POIXMLDocumentPart CreateDocumentPartTwoParams(Type cls, POIXMLDocumentPart parent, PackagePart part) + { + //if (cls == typeof(XWPFDocument)) + //return new XWPFDocument(parent, part); + //if (cls == typeof(XSSFWorkbook)) + //return new XSSFWorkbook(parent, part); + if (cls == typeof(XWPFComments)) + return new XWPFComments(parent, part); + //if (cls == typeof(XWPFFootnotes)) + //return new XWPFFootnotes(parent, part); + if (cls == typeof(XWPFFooter)) + return new XWPFFooter(parent, part); + if (cls == typeof(XWPFHeader)) + return new XWPFHeader(parent, part); + //if (cls == typeof(XWPFNumbering)) + //return new XWPFNumbering(parent, part); + //if (cls == typeof(XWPFPictureData)) + //return new XWPFPictureData(parent, part); + //if (cls == typeof(XWPFSettings)) + //return new XWPFSettings(parent, part); + //if (cls == typeof(XWPFStyles)) + //return new XWPFStyles(parent, part); + //if (cls == typeof(XSSFChart)) + //return new XSSFChart(parent, part); + //if (cls == typeof(XSSFDrawing)) + //return new XSSFDrawing(parent, part); + //if (cls == typeof(XSSFPictureData)) + //return new XSSFPictureData(parent, part); + //if (cls == typeof(XSSFPivotCache)) + //return new XSSFPivotCache(parent, part); + //if (cls == typeof(XSSFPivotCacheDefinition)) + //return new XSSFPivotCacheDefinition(parent, part); + //if (cls == typeof(XSSFPivotCacheRecords)) + //return new XSSFPivotCacheRecords(parent, part); + //if (cls == typeof(XSSFPivotTable)) + //return new XSSFPivotTable(parent, part); + //if (cls == typeof(XSSFSheet)) + //return new XSSFSheet(parent, part); + //if (cls == typeof(XSSFChartSheet)) + //return new XSSFChartSheet(parent, part); + //if (cls == typeof(XSSFDialogsheet)) + //return new XSSFDialogsheet(parent, part); + //if (cls == typeof(XSSFTable)) + //return new XSSFTable(parent, part); + //if (cls == typeof(XSSFVBAPart)) + //return new XSSFVBAPart(parent, part); + //if (cls == typeof(XSSFVMLDrawing)) + //return new XSSFVMLDrawing(parent, part); + //if (cls == typeof(CalculationChain)) + //return new CalculationChain(parent, part); + //if (cls == typeof(CommentsTable)) + //return new CommentsTable(parent, part); + //if (cls == typeof(ExternalLinksTable)) + //return new ExternalLinksTable(parent, part); + //if (cls == typeof(MapInfo)) + //return new MapInfo(parent, part); + //if (cls == typeof(SharedStringsTable)) + //return new SharedStringsTable(parent, part); + //if (cls == typeof(SingleXmlCells)) + //return new SingleXmlCells(parent, part); + //if (cls == typeof(StylesTable)) + //return new StylesTable(parent, part); + //if (cls == typeof(ThemesTable)) + //return new ThemesTable(parent, part); + + ThrowHelper_MissingMethod(); + return null; + } + } +} diff --git a/ooxml/XSSF/UserModel/XSSFChart.cs b/ooxml/XSSF/UserModel/XSSFChart.cs index f613b13fe..d4e2dbfa0 100644 --- a/ooxml/XSSF/UserModel/XSSFChart.cs +++ b/ooxml/XSSF/UserModel/XSSFChart.cs @@ -84,6 +84,8 @@ protected XSSFChart(PackagePart part) chart = chartSpaceDocument.GetChartSpace().chart; } + internal static XSSFChart InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFChart(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XSSF/UserModel/XSSFChartSheet.cs b/ooxml/XSSF/UserModel/XSSFChartSheet.cs index 69b2b66a5..c8deea61a 100644 --- a/ooxml/XSSF/UserModel/XSSFChartSheet.cs +++ b/ooxml/XSSF/UserModel/XSSFChartSheet.cs @@ -50,6 +50,9 @@ protected XSSFChartSheet(PackagePart part) { } + + internal static XSSFChartSheet InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFChartSheet(PackagePart part, PackageRelationship rel) : base(part) diff --git a/ooxml/XSSF/UserModel/XSSFFactory.cs b/ooxml/XSSF/UserModel/XSSFFactory.cs index 02d963f6c..676bb7e2f 100644 --- a/ooxml/XSSF/UserModel/XSSFFactory.cs +++ b/ooxml/XSSF/UserModel/XSSFFactory.cs @@ -19,7 +19,6 @@ limitations under the License. using NPOI.XSSF.UserModel; using System; using NPOI.OpenXml4Net.OPC; -using System.Reflection; namespace NPOI.XSSF.UserModel { @@ -56,20 +55,8 @@ protected override POIXMLRelation GetDescriptor(String relationshipType) protected override POIXMLDocumentPart CreateDocumentPart(Type cls, Type[] classes, Object[] values) { - if (classes == null) - { - classes = new Type[0]; - } - - ConstructorInfo constructor = cls.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, - null, classes, null); - if (constructor == null) - throw new MissingMethodException(); - if (values == null) - { - values = new object[0]; - } - return constructor.Invoke(values) as POIXMLDocumentPart; + // REMOVE-REFLECTION: Reflection is replaced with static dispatch. + return DocumentPartCreationHelper.CreateDocumentPart(cls, classes, values); } } } \ No newline at end of file diff --git a/ooxml/XSSF/UserModel/XSSFPivotCache.cs b/ooxml/XSSF/UserModel/XSSFPivotCache.cs index 485e4463c..e9248ef4d 100644 --- a/ooxml/XSSF/UserModel/XSSFPivotCache.cs +++ b/ooxml/XSSF/UserModel/XSSFPivotCache.cs @@ -55,6 +55,8 @@ protected XSSFPivotCache(PackagePart part) ReadFrom(part.GetInputStream()); } + internal static XSSFPivotCache InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFPivotCache(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XSSF/UserModel/XSSFPivotCacheDefinition.cs b/ooxml/XSSF/UserModel/XSSFPivotCacheDefinition.cs index 819ee79d8..110cf966d 100644 --- a/ooxml/XSSF/UserModel/XSSFPivotCacheDefinition.cs +++ b/ooxml/XSSF/UserModel/XSSFPivotCacheDefinition.cs @@ -53,6 +53,8 @@ protected XSSFPivotCacheDefinition(PackagePart part) ReadFrom(part.GetInputStream()); } + internal static XSSFPivotCacheDefinition InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFPivotCacheDefinition(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XSSF/UserModel/XSSFPivotCacheRecords.cs b/ooxml/XSSF/UserModel/XSSFPivotCacheRecords.cs index 77fbbffc6..59b291f23 100644 --- a/ooxml/XSSF/UserModel/XSSFPivotCacheRecords.cs +++ b/ooxml/XSSF/UserModel/XSSFPivotCacheRecords.cs @@ -49,6 +49,8 @@ protected XSSFPivotCacheRecords(PackagePart part) ReadFrom(part.GetInputStream()); } + internal static XSSFPivotCacheRecords InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFPivotCacheRecords(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XSSF/UserModel/XSSFPivotTable.cs b/ooxml/XSSF/UserModel/XSSFPivotTable.cs index aa8150fed..925e813a3 100644 --- a/ooxml/XSSF/UserModel/XSSFPivotTable.cs +++ b/ooxml/XSSF/UserModel/XSSFPivotTable.cs @@ -68,6 +68,8 @@ protected XSSFPivotTable(PackagePart part) ReadFrom(part.GetInputStream()); } + internal static XSSFPivotTable InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFPivotTable(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XSSF/UserModel/XSSFVMLDrawing.cs b/ooxml/XSSF/UserModel/XSSFVMLDrawing.cs index d28f1f575..54d7e9eab 100644 --- a/ooxml/XSSF/UserModel/XSSFVMLDrawing.cs +++ b/ooxml/XSSF/UserModel/XSSFVMLDrawing.cs @@ -98,6 +98,9 @@ protected XSSFVMLDrawing(PackagePart part) { Read(GetPackagePart().GetInputStream()); } + + internal static XSSFVMLDrawing InternalCreateInstance(PackagePart part) => new(part); + [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")] protected XSSFVMLDrawing(PackagePart part, PackageRelationship rel) : this(part) diff --git a/ooxml/XWPF/Usermodel/XWPFFactory.cs b/ooxml/XWPF/Usermodel/XWPFFactory.cs index 5c116197d..006a8e9fb 100644 --- a/ooxml/XWPF/Usermodel/XWPFFactory.cs +++ b/ooxml/XWPF/Usermodel/XWPFFactory.cs @@ -18,10 +18,9 @@ limitations under the License. namespace NPOI.XWPF.UserModel { using System; - using NPOI.OpenXml4Net.OPC; using NPOI.Util; - using System.Reflection; + using NPOI.XSSF.UserModel; /** * @author Yegor Kozlov @@ -55,19 +54,8 @@ protected override POIXMLRelation GetDescriptor(String relationshipType) protected override POIXMLDocumentPart CreateDocumentPart(Type cls, Type[] classes, Object[] values) { - if (classes == null) - { - classes = new Type[0]; - } - ConstructorInfo constructor = cls.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, - null, classes, null); - if (constructor == null) - throw new MissingMethodException(); - if (values == null) - { - values = new object[0]; - } - return constructor.Invoke(values) as POIXMLDocumentPart; + // REMOVE-REFLECTION: Reflection is replaced with static dispatch. + return DocumentPartCreationHelper.CreateDocumentPart(cls, classes, values); } } diff --git a/ooxml/XWPF/Usermodel/XWPFPictureData.cs b/ooxml/XWPF/Usermodel/XWPFPictureData.cs index 792e33c5d..1c0ed7d4e 100644 --- a/ooxml/XWPF/Usermodel/XWPFPictureData.cs +++ b/ooxml/XWPF/Usermodel/XWPFPictureData.cs @@ -63,6 +63,8 @@ protected XWPFPictureData() { } + internal static XWPFPictureData InternalCreateInstance() => new(); + /** * Construct XWPFPictureData from a package part * From b99121ddfda1d77edc09f8c654d33ad9e9d943a9 Mon Sep 17 00:00:00 2001 From: Gan Keyu Date: Sun, 13 Aug 2023 12:04:56 +0800 Subject: [PATCH 2/2] move file --- .../DocumentPartCreationHelper.cs | 77 ++++++++++--------- ooxml/XSSF/UserModel/XSSFFactory.cs | 1 - ooxml/XWPF/Usermodel/XWPFFactory.cs | 1 - 3 files changed, 39 insertions(+), 40 deletions(-) rename ooxml/{XSSF/UserModel => Util}/DocumentPartCreationHelper.cs (82%) diff --git a/ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs b/ooxml/Util/DocumentPartCreationHelper.cs similarity index 82% rename from ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs rename to ooxml/Util/DocumentPartCreationHelper.cs index 3ea8b64f5..1887ae02d 100644 --- a/ooxml/XSSF/UserModel/DocumentPartCreationHelper.cs +++ b/ooxml/Util/DocumentPartCreationHelper.cs @@ -18,6 +18,7 @@ */ using NPOI.OpenXml4Net.OPC; using NPOI.XSSF.Model; +using NPOI.XSSF.UserModel; using NPOI.XWPF.UserModel; using System; using System.Collections.Generic; @@ -25,11 +26,11 @@ using System.Text; using System.Threading.Tasks; -namespace NPOI.XSSF.UserModel +namespace NPOI.Util { internal static class DocumentPartCreationHelper { - public static POIXMLDocumentPart CreateDocumentPart(Type cls, Type[] types, Object[] values) + public static POIXMLDocumentPart CreateDocumentPart(Type cls, Type[] types, object[] values) { if ((values is null || values.Length == 0) && (types is null || types.Length == 0)) { @@ -93,9 +94,9 @@ private static POIXMLDocumentPart CreateDocumentPartParamless(Type cls) if (cls == typeof(XSSFSheet)) return new XSSFSheet(); //if (cls == typeof(XSSFChartSheet)) - //return new XSSFChartSheet(); + //return new XSSFChartSheet(); //if (cls == typeof(XSSFDialogsheet)) - //return new XSSFDialogsheet(); + //return new XSSFDialogsheet(); if (cls == typeof(XSSFTable)) return new XSSFTable(); if (cls == typeof(XSSFVBAPart)) @@ -125,17 +126,17 @@ private static POIXMLDocumentPart CreateDocumentPartParamless(Type cls) private static POIXMLDocumentPart CreateDocumentPartOneParam(Type cls, PackagePart part) { //if (cls == typeof(XWPFDocument)) - //return new XWPFDocument(part); + //return new XWPFDocument(part); //if (cls == typeof(XSSFWorkbook)) - //return new XSSFWorkbook(part); + //return new XSSFWorkbook(part); //if (cls == typeof(XWPFComments)) - //return new XWPFComments(part); + //return new XWPFComments(part); if (cls == typeof(XWPFFootnotes)) return new XWPFFootnotes(part); //if (cls == typeof(XWPFFooter)) - //return new XWPFFooter(part); + //return new XWPFFooter(part); //if (cls == typeof(XWPFHeader)) - //return new XWPFHeader(part); + //return new XWPFHeader(part); if (cls == typeof(XWPFNumbering)) return new XWPFNumbering(part); if (cls == typeof(XWPFPictureData)) @@ -163,7 +164,7 @@ private static POIXMLDocumentPart CreateDocumentPartOneParam(Type cls, PackagePa if (cls == typeof(XSSFChartSheet)) return XSSFChartSheet.InternalCreateInstance(part); //if (cls == typeof(XSSFDialogsheet)) - //return new XSSFDialogsheet(part); + //return new XSSFDialogsheet(part); if (cls == typeof(XSSFTable)) return new XSSFTable(part); if (cls == typeof(XSSFVBAPart)) @@ -193,67 +194,67 @@ private static POIXMLDocumentPart CreateDocumentPartOneParam(Type cls, PackagePa private static POIXMLDocumentPart CreateDocumentPartTwoParams(Type cls, POIXMLDocumentPart parent, PackagePart part) { //if (cls == typeof(XWPFDocument)) - //return new XWPFDocument(parent, part); + //return new XWPFDocument(parent, part); //if (cls == typeof(XSSFWorkbook)) - //return new XSSFWorkbook(parent, part); + //return new XSSFWorkbook(parent, part); if (cls == typeof(XWPFComments)) return new XWPFComments(parent, part); //if (cls == typeof(XWPFFootnotes)) - //return new XWPFFootnotes(parent, part); + //return new XWPFFootnotes(parent, part); if (cls == typeof(XWPFFooter)) return new XWPFFooter(parent, part); if (cls == typeof(XWPFHeader)) return new XWPFHeader(parent, part); //if (cls == typeof(XWPFNumbering)) - //return new XWPFNumbering(parent, part); + //return new XWPFNumbering(parent, part); //if (cls == typeof(XWPFPictureData)) - //return new XWPFPictureData(parent, part); + //return new XWPFPictureData(parent, part); //if (cls == typeof(XWPFSettings)) - //return new XWPFSettings(parent, part); + //return new XWPFSettings(parent, part); //if (cls == typeof(XWPFStyles)) - //return new XWPFStyles(parent, part); + //return new XWPFStyles(parent, part); //if (cls == typeof(XSSFChart)) - //return new XSSFChart(parent, part); + //return new XSSFChart(parent, part); //if (cls == typeof(XSSFDrawing)) - //return new XSSFDrawing(parent, part); + //return new XSSFDrawing(parent, part); //if (cls == typeof(XSSFPictureData)) - //return new XSSFPictureData(parent, part); + //return new XSSFPictureData(parent, part); //if (cls == typeof(XSSFPivotCache)) - //return new XSSFPivotCache(parent, part); + //return new XSSFPivotCache(parent, part); //if (cls == typeof(XSSFPivotCacheDefinition)) - //return new XSSFPivotCacheDefinition(parent, part); + //return new XSSFPivotCacheDefinition(parent, part); //if (cls == typeof(XSSFPivotCacheRecords)) - //return new XSSFPivotCacheRecords(parent, part); + //return new XSSFPivotCacheRecords(parent, part); //if (cls == typeof(XSSFPivotTable)) - //return new XSSFPivotTable(parent, part); + //return new XSSFPivotTable(parent, part); //if (cls == typeof(XSSFSheet)) - //return new XSSFSheet(parent, part); + //return new XSSFSheet(parent, part); //if (cls == typeof(XSSFChartSheet)) - //return new XSSFChartSheet(parent, part); + //return new XSSFChartSheet(parent, part); //if (cls == typeof(XSSFDialogsheet)) - //return new XSSFDialogsheet(parent, part); + //return new XSSFDialogsheet(parent, part); //if (cls == typeof(XSSFTable)) - //return new XSSFTable(parent, part); + //return new XSSFTable(parent, part); //if (cls == typeof(XSSFVBAPart)) - //return new XSSFVBAPart(parent, part); + //return new XSSFVBAPart(parent, part); //if (cls == typeof(XSSFVMLDrawing)) - //return new XSSFVMLDrawing(parent, part); + //return new XSSFVMLDrawing(parent, part); //if (cls == typeof(CalculationChain)) - //return new CalculationChain(parent, part); + //return new CalculationChain(parent, part); //if (cls == typeof(CommentsTable)) - //return new CommentsTable(parent, part); + //return new CommentsTable(parent, part); //if (cls == typeof(ExternalLinksTable)) - //return new ExternalLinksTable(parent, part); + //return new ExternalLinksTable(parent, part); //if (cls == typeof(MapInfo)) - //return new MapInfo(parent, part); + //return new MapInfo(parent, part); //if (cls == typeof(SharedStringsTable)) - //return new SharedStringsTable(parent, part); + //return new SharedStringsTable(parent, part); //if (cls == typeof(SingleXmlCells)) - //return new SingleXmlCells(parent, part); + //return new SingleXmlCells(parent, part); //if (cls == typeof(StylesTable)) - //return new StylesTable(parent, part); + //return new StylesTable(parent, part); //if (cls == typeof(ThemesTable)) - //return new ThemesTable(parent, part); + //return new ThemesTable(parent, part); ThrowHelper_MissingMethod(); return null; diff --git a/ooxml/XSSF/UserModel/XSSFFactory.cs b/ooxml/XSSF/UserModel/XSSFFactory.cs index 676bb7e2f..263babc7d 100644 --- a/ooxml/XSSF/UserModel/XSSFFactory.cs +++ b/ooxml/XSSF/UserModel/XSSFFactory.cs @@ -16,7 +16,6 @@ limitations under the License. ==================================================================== */ using NPOI.Util; -using NPOI.XSSF.UserModel; using System; using NPOI.OpenXml4Net.OPC; namespace NPOI.XSSF.UserModel diff --git a/ooxml/XWPF/Usermodel/XWPFFactory.cs b/ooxml/XWPF/Usermodel/XWPFFactory.cs index 006a8e9fb..06196338a 100644 --- a/ooxml/XWPF/Usermodel/XWPFFactory.cs +++ b/ooxml/XWPF/Usermodel/XWPFFactory.cs @@ -20,7 +20,6 @@ namespace NPOI.XWPF.UserModel using System; using NPOI.OpenXml4Net.OPC; using NPOI.Util; - using NPOI.XSSF.UserModel; /** * @author Yegor Kozlov