mirror of https://github.com/apache/poi.git
Fixed XSSFWorkbook#setRepeatingRowsAndColumns to tolerate sheet names with quotes, see bugzilla #47294
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@783445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
544832d272
commit
b10d44cf52
|
@ -35,6 +35,7 @@
|
||||||
<release version="3.5-beta7" date="2009-??-??">
|
<release version="3.5-beta7" date="2009-??-??">
|
||||||
</release>
|
</release>
|
||||||
<release version="3.5-beta6" date="2009-06-??">
|
<release version="3.5-beta6" date="2009-06-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">47294 - Fixed XSSFWorkbook#setRepeatingRowsAndColumns to tolerate sheet names with quotes</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">47309 - Fixed logic in HSSFCell.getCellComment to handle sheets with more than 65536 comments</action>
|
<action dev="POI-DEVELOPERS" type="fix">47309 - Fixed logic in HSSFCell.getCellComment to handle sheets with more than 65536 comments</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46776 - Added clone() method to MulBlankRecord to fix crash in Sheet.cloneSheet()</action>
|
<action dev="POI-DEVELOPERS" type="fix">46776 - Added clone() method to MulBlankRecord to fix crash in Sheet.cloneSheet()</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">47244 - Fixed HSSFSheet to handle missing header / footer records</action>
|
<action dev="POI-DEVELOPERS" type="fix">47244 - Fixed HSSFSheet to handle missing header / footer records</action>
|
||||||
|
|
|
@ -944,7 +944,9 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
|
||||||
CellReference colRef = new CellReference(sheetName, 0, startC, true, true);
|
CellReference colRef = new CellReference(sheetName, 0, startC, true, true);
|
||||||
CellReference colRef2 = new CellReference(sheetName, 0, endC, true, true);
|
CellReference colRef2 = new CellReference(sheetName, 0, endC, true, true);
|
||||||
|
|
||||||
String c = "'" + sheetName + "'!$" + colRef.getCellRefParts()[2] + ":$" + colRef2.getCellRefParts()[2];
|
String escapedName = SheetNameFormatter.format(sheetName);
|
||||||
|
|
||||||
|
String c = escapedName + "!$" + colRef.getCellRefParts()[2] + ":$" + colRef2.getCellRefParts()[2];
|
||||||
|
|
||||||
CellReference rowRef = new CellReference(sheetName, startR, 0, true, true);
|
CellReference rowRef = new CellReference(sheetName, startR, 0, true, true);
|
||||||
CellReference rowRef2 = new CellReference(sheetName, endR, 0, true, true);
|
CellReference rowRef2 = new CellReference(sheetName, endR, 0, true, true);
|
||||||
|
@ -952,7 +954,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
|
||||||
String r = "";
|
String r = "";
|
||||||
|
|
||||||
if (!rowRef.getCellRefParts()[1].equals("0") && !rowRef2.getCellRefParts()[1].equals("0")) {
|
if (!rowRef.getCellRefParts()[1].equals("0") && !rowRef2.getCellRefParts()[1].equals("0")) {
|
||||||
r = ",'" + sheetName + "'!$" + rowRef.getCellRefParts()[1] + ":$" + rowRef2.getCellRefParts()[1];
|
r = "," + escapedName + "!$" + rowRef.getCellRefParts()[1] + ":$" + rowRef2.getCellRefParts()[1];
|
||||||
}
|
}
|
||||||
return c + r;
|
return c + r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class TestXSSFName extends BaseTestNamedRange {
|
||||||
XSSFName nr2 = nwb.getNameAt(1);
|
XSSFName nr2 = nwb.getNameAt(1);
|
||||||
|
|
||||||
assertEquals(XSSFName.BUILTIN_PRINT_TITLE, nr2.getNameName());
|
assertEquals(XSSFName.BUILTIN_PRINT_TITLE, nr2.getNameName());
|
||||||
assertEquals("'SecondSheet'!$B:$C,'SecondSheet'!$1:$1", nr2.getRefersToFormula());
|
assertEquals("SecondSheet!$B:$C,SecondSheet!$1:$1", nr2.getRefersToFormula());
|
||||||
|
|
||||||
nwb.setRepeatingRowsAndColumns(1, -1, -1, -1, -1);
|
nwb.setRepeatingRowsAndColumns(1, -1, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,6 +293,16 @@ public abstract class BaseTestWorkbook extends TestCase {
|
||||||
assertSame(row, cell.getRow());
|
assertSame(row, cell.getRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSetRepeatingRowsAnsColumns(){
|
||||||
|
Workbook wb = getTestDataProvider().createWorkbook();
|
||||||
|
Sheet sheet1 = wb.createSheet();
|
||||||
|
wb.setRepeatingRowsAndColumns(wb.getSheetIndex(sheet1), 0, 0, 0, 3);
|
||||||
|
|
||||||
|
//must handle sheets with quotas, see Bugzilla #47294
|
||||||
|
Sheet sheet2 = wb.createSheet("My' Sheet");
|
||||||
|
wb.setRepeatingRowsAndColumns(wb.getSheetIndex(sheet2), 0, 0, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that all of the unicode capable string fields can be set, written and then read back
|
* Tests that all of the unicode capable string fields can be set, written and then read back
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue