aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2013-11-28 15:15:59 +0000
committerDominik Stadler <centic@apache.org>2013-11-28 15:15:59 +0000
commit861ed3b5ef2e385a101cffaa199d762bb985afb7 (patch)
tree586e1abf17a0a6d1e786f8e0a13b33f248fc8312
parent2944dbb10395d1237fc53c6072aa27c9251566a2 (diff)
downloadpoi-861ed3b5ef2e385a101cffaa199d762bb985afb7.tar.gz
poi-861ed3b5ef2e385a101cffaa199d762bb985afb7.zip
Bug 55745: fix handling of tables in XSSF if there are comments as well, there is not much sense in leaving the loop on the first instance of comment table and skipping all the other tables.
git-svn-id: https://svn.apache.org/repos/asf/poi/tags/REL_3_9@1546385 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
index ab9e878556..4210323bce 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
@@ -33,18 +33,7 @@ import org.apache.poi.xssf.model.CalculationChain;
import org.apache.poi.xssf.model.CommentsTable;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetData;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetProtection;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCalcMode;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
@@ -1107,4 +1096,22 @@ public final class TestXSSFSheet extends BaseTestSheet {
sheet = workbook.getSheet("Sheet 1");
assertEquals(false, sheet.getForceFormulaRecalculation());
}
+
+ public static void test55745() throws Exception {
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("55745.xlsx");
+ XSSFSheet sheet = wb.getSheetAt(0);
+ List<XSSFTable> tables = sheet.getTables();
+ /*System.out.println(tables.size());
+
+ for(XSSFTable table : tables) {
+ System.out.println("XPath: " + table.getCommonXpath());
+ System.out.println("Name: " + table.getName());
+ System.out.println("Mapped Cols: " + table.getNumerOfMappedColumns());
+ System.out.println("Rowcount: " + table.getRowCount());
+ System.out.println("End Cell: " + table.getEndCellReference());
+ System.out.println("Start Cell: " + table.getStartCellReference());
+ }*/
+ assertEquals("Sheet should contain 8 tables", 8, tables.size());
+ assertNotNull("Sheet should contain a comments table", sheet.getCommentsTable(false));
+ }
}