Sfoglia il codice sorgente

[github-164] Fix Bug in XSSFTable.setCellReferences when table is single cell. Thanks to Travis Russell. This closes #164

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1871184 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_4_1_2
PJ Fanning 4 anni fa
parent
commit
f12a414662

+ 1
- 1
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java Vedi File

@@ -637,7 +637,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
if (ref != null) {
String[] boundaries = ref.split(":", 2);
String from = boundaries[0];
String to = boundaries[1];
String to = boundaries.length == 2 ? boundaries[1] : boundaries[0];
startCellReference = new CellReference(from);
endCellReference = new CellReference(to);
}

+ 8
- 0
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFTable.java Vedi File

@@ -215,6 +215,14 @@ public final class TestXSSFTable {
}
}

@Test
public void getEndCellReferenceFromSingleCellTable() throws IOException {
try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("SingleCellTable.xlsx")) {
XSSFTable table = wb.getTable("Table3");
assertEquals(new CellReference("A2"), table.getEndCellReference());
}
}

@Test
public void getNumberOfMappedColumns() throws IOException {
try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("StructuredReferences.xlsx")) {

Loading…
Annulla
Salva