diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
index decd3b6b3..5dba8d2eb 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
@@ -110,7 +110,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Named ranges had the right reference, but
- * the wrong sheet name
+ * the wrong sheet name
*/
@Test
public void bug45430() throws IOException {
@@ -224,9 +224,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Excel will sometimes write a button with a textbox
- * containing >br< (not closed!).
+ * containing >br< (not closed!).
* Clearly Excel shouldn't do this, but test that we can
- * read the file despite the naughtyness
+ * read the file despite the naughtyness
*/
@Test
public void bug49020() throws IOException {
@@ -247,7 +247,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Names which are defined with a Sheet
- * should return that sheet index properly
+ * should return that sheet index properly
*/
@Test
public void bug48923() throws IOException {
@@ -284,10 +284,10 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Problem with evaluation formulas due to
- * NameXPtgs.
+ * NameXPtgs.
* Blows up on:
- * IF(B6= (ROUNDUP(B6,0) + ROUNDDOWN(B6,0))/2, MROUND(B6,2),ROUND(B6,0))
- *
+ * IF(B6= (ROUNDUP(B6,0) + ROUNDDOWN(B6,0))/2, MROUND(B6,2),ROUND(B6,0))
+ *
* TODO: delete this test case when MROUND and VAR are implemented
*/
@Test
@@ -299,14 +299,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Try each cell individually
XSSFFormulaEvaluator eval = new XSSFFormulaEvaluator(wb);
- for(int i=0; i
* The OPC spec tolerates both of these peculiarities, so does POI
*/
@Test
public void bug49609() throws IOException {
- XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49609.xlsx");
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49609.xlsx");
assertEquals("FAM", wb.getSheetName(0));
assertEquals("Cycle", wb.getSheetAt(0).getRow(0).getCell(1).getStringCellValue());
wb.close();
@@ -420,7 +420,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
@Test
public void bug49783() throws IOException {
- Workbook wb = XSSFTestDataSamples.openSampleWorkbook("49783.xlsx");
+ Workbook wb = XSSFTestDataSamples.openSampleWorkbook("49783.xlsx");
Sheet sheet = wb.getSheetAt(0);
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
Cell cell;
@@ -441,16 +441,16 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals("sale_1*sale_2", cell.getCellFormula());
assertEquals(CellType.ERROR, evaluator.evaluateInCell(cell).getCellTypeEnum());
assertEquals("#REF!", FormulaError.forInt(cell.getErrorCellValue()).getString());
-
+
wb.close();
}
/**
* Creating a rich string of "hello world" and applying
- * a font to characters 1-5 means we have two strings,
- * "hello" and " world". As such, we need to apply
- * preserve spaces to the 2nd bit, lest we end up
- * with something like "helloworld" !
+ * a font to characters 1-5 means we have two strings,
+ * "hello" and " world". As such, we need to apply
+ * preserve spaces to the 2nd bit, lest we end up
+ * with something like "helloworld" !
*/
@Test
public void bug49941() throws IOException {
@@ -520,7 +520,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Save and check
XSSFWorkbook wb3 = XSSFTestDataSamples.writeOutAndReadBack(wb2);
wb2.close();
-
+
s = wb3.getSheetAt(0);
r = s.getRow(0);
c = r.getCell(0);
@@ -544,7 +544,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
wb.write(b2);
wb.write(b3);
- for(byte[] data : new byte[][] {
+ for (byte[] data : new byte[][]{
b1.toByteArray(), b2.toByteArray(), b3.toByteArray()
}) {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
@@ -553,7 +553,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals(10, wb2.getStylesSource().getNumCellStyles());
wb2.close();
}
-
+
wb.close();
}
@@ -626,14 +626,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
validateCells(sheet);
sheet.getRow(5).removeCell(sheet.getRow(5).getCell(0)); // go
validateCells(sheet);
-
+
wb.close();
}
private void validateCells(XSSFSheet sheet) {
- for(Row row : sheet) {
+ for (Row row : sheet) {
// trigger handling
- ((XSSFRow)row).onDocumentWrite();
+ ((XSSFRow) row).onDocumentWrite();
}
}
@@ -643,9 +643,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
FormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
Sheet sheet = wb.getSheetAt(0);
- for(Row row : sheet){
- for(Cell cell : row){
- if(cell.getCellTypeEnum() == CellType.FORMULA){
+ for (Row row : sheet) {
+ for (Cell cell : row) {
+ if (cell.getCellTypeEnum() == CellType.FORMULA) {
formulaEvaluator.evaluateInCell(cell); // caused NPE on some cells
}
}
@@ -676,7 +676,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
formulaEvaluator.evaluateFormulaCellEnum(b3);
assertEquals("B1+B2", b3.getCellFormula()); // The newline is lost for shared formulas
assertEquals(3.0, b3.getNumericCellValue(), 0);
-
+
wb.close();
}
@@ -703,7 +703,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Check we can write it out and read it back as-is
XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb1);
wb1.close();
-
+
sheet = wb2.getSheetAt(0);
row = sheet.getRow(0);
cellWith = row.getCell(0);
@@ -723,7 +723,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// Write out and re-check
XSSFWorkbook wb3 = XSSFTestDataSamples.writeOutAndReadBack(wb2);
wb2.close();
-
+
sheet = wb3.getSheetAt(0);
row = sheet.getRow(0);
@@ -735,14 +735,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
comment = cellWithoutComment.getCellComment();
assertEquals(exp, comment.getString().getString());
-
+
wb3.close();
}
/**
* When the cell background colour is set with one of the first
- * two columns of the theme colour palette, the colours are
- * shades of white or black.
+ * two columns of the theme colour palette, the colours are
+ * shades of white or black.
* For those cases, ensure we don't break on reading the colour
*/
@Test
@@ -750,12 +750,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("50299.xlsx");
// Check all the colours
- for(int sn=0; sn 0; sn--)
- {
+ for (int sn = sheetNb - 1; sn > 0; sn--) {
wb.removeSheetAt(sn);
}
}
@@ -2255,7 +2253,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Expected:
-
+ *
* [ 0][ 2][ 4]
*/
@Test
@@ -2283,7 +2281,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* Expected:
-
+ *
* [ 0] <- number
* [ 2] <- formula
* [ 4] <- formula
@@ -2328,7 +2326,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
} finally {
- wb.close();
+ wb.close();
}
}
@@ -2348,7 +2346,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals(3, wbBack.getNumberOfSheets());
// TODO Re-check sheet contents
// TODO Re-check formula evaluation
-
+
wb.close();
wbBack.close();
}
@@ -2376,11 +2374,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
XSSFRow destRow = newSheet.createRow(0);
XSSFCell newCell = destRow.createCell(0);
- //newCell.getCellStyle().cloneStyleFrom(cellStyle);
+ //newCell.getCellStyle().cloneStyleFrom(cellStyle);
CellStyle newCellStyle = targetWorkbook.createCellStyle();
newCellStyle.cloneStyleFrom(cellStyle);
newCell.setCellStyle(newCellStyle);
- checkStyle(newCell.getCellStyle());
+ checkStyle(newCell.getCellStyle());
newCell.setCellValue(oldCell.getStringCellValue());
// OutputStream os = new FileOutputStream("output.xlsm");
@@ -2393,14 +2391,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
XSSFWorkbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(targetWorkbook);
XSSFCellStyle styleBack = wbBack.getSheetAt(0).getRow(0).getCell(0).getCellStyle();
checkStyle(styleBack);
-
+
targetWorkbook.close();
wbBack.close();
}
/**
* Paragraph with property BuFont but none of the properties
- * BuNone, BuChar, and BuAutoNum, used to trigger a NPE
+ * BuNone, BuChar, and BuAutoNum, used to trigger a NPE
* Excel treats this as not-bulleted, so now do we
*/
@Test
@@ -2417,31 +2415,31 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals(1, shapes.size());
assertTrue(shapes.get(0) instanceof XSSFSimpleShape);
- XSSFSimpleShape shape = (XSSFSimpleShape)shapes.get(0);
+ XSSFSimpleShape shape = (XSSFSimpleShape) shapes.get(0);
// Used to throw a NPE
String text = shape.getText();
// No bulleting info included
assertEquals("test ok", text);
-
+
workbook.close();
}
- private void checkStyle(XSSFCellStyle cellStyle) {
- assertNotNull(cellStyle);
+ private void checkStyle(XSSFCellStyle cellStyle) {
+ assertNotNull(cellStyle);
assertEquals(0, cellStyle.getFillForegroundColor());
assertNotNull(cellStyle.getFillForegroundXSSFColor());
XSSFColor fgColor = cellStyle.getFillForegroundColorColor();
- assertNotNull(fgColor);
- assertEquals("FF00FFFF", fgColor.getARGBHex());
+ assertNotNull(fgColor);
+ assertEquals("FF00FFFF", fgColor.getARGBHex());
assertEquals(0, cellStyle.getFillBackgroundColor());
assertNotNull(cellStyle.getFillBackgroundXSSFColor());
XSSFColor bgColor = cellStyle.getFillBackgroundColorColor();
- assertNotNull(bgColor);
- assertEquals("FF00FFFF", fgColor.getARGBHex());
- }
+ assertNotNull(bgColor);
+ assertEquals("FF00FFFF", fgColor.getARGBHex());
+ }
@Test
public void bug57642() throws IOException {
@@ -2463,14 +2461,14 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
/**
* .xlsx supports 64000 cell styles, the style indexes after
- * 32,767 must not be -32,768, then -32,767, -32,766
+ * 32,767 must not be -32,768, then -32,767, -32,766
*/
@SuppressWarnings("resource")
@Test
public void bug57880() throws IOException {
int numStyles = 33000;
XSSFWorkbook wb = new XSSFWorkbook();
- for (int i=1; i data;
data = new TreeMap();
- data.put("1", new Object[] {"ID", "NAME", "LASTNAME"});
- data.put("2", new Object[] {2, "Amit", "Shukla"});
- data.put("3", new Object[] {1, "Lokesh", "Gupta"});
- data.put("4", new Object[] {4, "John", "Adwards"});
- data.put("5", new Object[] {2, "Brian", "Schultz"});
+ data.put("1", new Object[]{"ID", "NAME", "LASTNAME"});
+ data.put("2", new Object[]{2, "Amit", "Shukla"});
+ data.put("3", new Object[]{1, "Lokesh", "Gupta"});
+ data.put("4", new Object[]{4, "John", "Adwards"});
+ data.put("5", new Object[]{2, "Brian", "Schultz"});
int rownum = 1;
- for (Map.Entry me : data.entrySet()) {
+ for (Map.Entry me : data.entrySet()) {
final Row row;
- if(createRow) {
+ if (createRow) {
row = sheet.createRow(rownum++);
} else {
row = sheet.getRow(rownum++);
@@ -2535,28 +2533,28 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
int cellnum = 0;
for (Object obj : me.getValue()) {
Cell cell = row.getCell(cellnum);
- if(cell == null){
+ if (cell == null) {
cell = row.createCell(cellnum);
} else {
- if(cell.getCellTypeEnum() == CellType.FORMULA) {
+ if (cell.getCellTypeEnum() == CellType.FORMULA) {
cell.setCellFormula(null);
cell.getCellStyle().setDataFormat((short) 0);
}
}
- if(obj instanceof String) {
- cell.setCellValue((String)obj);
- } else if(obj instanceof Integer) {
- cell.setCellValue((Integer)obj);
- }
- cellnum++;
+ if (obj instanceof String) {
+ cell.setCellValue((String) obj);
+ } else if (obj instanceof Integer) {
+ cell.setCellValue((Integer) obj);
+ }
+ cellnum++;
}
}
XSSFFormulaEvaluator.evaluateAllFormulaCells((XSSFWorkbook) wb);
wb.getCreationHelper().createFormulaEvaluator().evaluateAll();
- CalculationChain chain = ((XSSFWorkbook)wb).getCalculationChain();
- for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
+ CalculationChain chain = ((XSSFWorkbook) wb).getCalculationChain();
+ for (CTCalcCell calc : chain.getCTCalcChain().getCList()) {
// A2 to A6 should be gone
assertFalse(calc.getR().equals("A2"));
assertFalse(calc.getR().equals("A3"));
@@ -2569,8 +2567,8 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
Sheet sheetBack = wbBack.getSheet("Func");
assertNotNull(sheetBack);
- chain = ((XSSFWorkbook)wbBack).getCalculationChain();
- for(CTCalcCell calc : chain.getCTCalcChain().getCList()) {
+ chain = ((XSSFWorkbook) wbBack).getCalculationChain();
+ for (CTCalcCell calc : chain.getCTCalcChain().getCList()) {
// A2 to A6 should be gone
assertFalse(calc.getR().equals("A2"));
assertFalse(calc.getR().equals("A3"));
@@ -2608,8 +2606,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
if (null == expectedResultOrNull) {
assertEquals(CellType.ERROR, intF.getCachedFormulaResultTypeEnum());
expectedResultOrNull = "#VALUE!";
- }
- else {
+ } else {
assertEquals(CellType.NUMERIC, intF.getCachedFormulaResultTypeEnum());
}
@@ -2632,7 +2629,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
// color index
assertEquals(64, style.getFillBackgroundColor());
- XSSFColor color = ((XSSFCellStyle)style).getFillBackgroundXSSFColor();
+ XSSFColor color = ((XSSFCellStyle) style).getFillBackgroundXSSFColor();
assertNotNull(color);
// indexed color
@@ -2649,9 +2646,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
public void test50755_workday_formula_example() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("50755_workday_formula_example.xlsx");
Sheet sheet = wb.getSheet("Sheet1");
- for(Row aRow : sheet) {
+ for (Row aRow : sheet) {
Cell cell = aRow.getCell(1);
- if(cell.getCellTypeEnum() == CellType.FORMULA) {
+ if (cell.getCellTypeEnum() == CellType.FORMULA) {
String formula = cell.getCellFormula();
//System.out.println("formula: " + formula);
assertNotNull(formula);
@@ -2750,45 +2747,43 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
Sheet sheet = wb.getSheetAt(0);
Cell cellA1 = sheet.getRow(0).getCell(0);
Cell cellA2 = sheet.getRow(1).getCell(0);
-
+
assertEquals(0, cellA1.getCellStyle().getFillForegroundColor());
- assertEquals("FFFDFDFD", ((XSSFColor)cellA1.getCellStyle().getFillForegroundColorColor()).getARGBHex());
+ assertEquals("FFFDFDFD", ((XSSFColor) cellA1.getCellStyle().getFillForegroundColorColor()).getARGBHex());
assertEquals(0, cellA2.getCellStyle().getFillForegroundColor());
- assertEquals("FFFDFDFD", ((XSSFColor)cellA2.getCellStyle().getFillForegroundColorColor()).getARGBHex());
-
+ assertEquals("FFFDFDFD", ((XSSFColor) cellA2.getCellStyle().getFillForegroundColorColor()).getARGBHex());
+
SheetConditionalFormatting cond = sheet.getSheetConditionalFormatting();
assertEquals(2, cond.getNumConditionalFormattings());
assertEquals(1, cond.getConditionalFormattingAt(0).getNumberOfRules());
assertEquals(64, cond.getConditionalFormattingAt(0).getRule(0).getPatternFormatting().getFillForegroundColor());
assertEquals("ISEVEN(ROW())", cond.getConditionalFormattingAt(0).getRule(0).getFormula1());
- assertNull(((XSSFColor)cond.getConditionalFormattingAt(0).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex());
+ assertNull(((XSSFColor) cond.getConditionalFormattingAt(0).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex());
assertEquals(1, cond.getConditionalFormattingAt(1).getNumberOfRules());
- assertEquals(64, cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColor());
+ assertEquals(64, cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColor());
assertEquals("ISEVEN(ROW())", cond.getConditionalFormattingAt(1).getRule(0).getFormula1());
- assertNull(((XSSFColor)cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex());
-
+ assertNull(((XSSFColor) cond.getConditionalFormattingAt(1).getRule(0).getPatternFormatting().getFillForegroundColorColor()).getARGBHex());
+
wb.close();
}
@Test
public void test51998() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("51998.xlsx");
-
+
Set sheetNames = new HashSet();
-
- for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++)
- {
+
+ for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
sheetNames.add(wb.getSheetName(sheetNum));
}
-
- for (String sheetName : sheetNames)
- {
+
+ for (String sheetName : sheetNames) {
int sheetIndex = wb.getSheetIndex(sheetName);
-
+
wb.removeSheetAt(sheetIndex);
-
+
Sheet newSheet = wb.createSheet();
//Sheet newSheet = wb.createSheet(sheetName);
int newSheetIndex = wb.getSheetIndex(newSheet);
@@ -2796,30 +2791,30 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
wb.setSheetName(newSheetIndex, sheetName);
wb.setSheetOrder(sheetName, sheetIndex);
}
-
+
Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
wb.close();
-
+
assertNotNull(wbBack);
wbBack.close();
}
-
+
@Test
public void test58731() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("58731.xlsx");
Sheet sheet = wb.createSheet("Java Books");
-
+
Object[][] bookData = {
{"Head First Java", "Kathy Serria", 79},
{"Effective Java", "Joshua Bloch", 36},
{"Clean Code", "Robert martin", 42},
{"Thinking in Java", "Bruce Eckel", 35},
};
-
+
int rowCount = 0;
for (Object[] aBook : bookData) {
Row row = sheet.createRow(rowCount++);
-
+
int columnCount = 0;
for (Object field : aBook) {
Cell cell = row.createCell(columnCount++);
@@ -2830,21 +2825,21 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
}
}
-
+
Workbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb);
sheet = wb2.getSheet("Java Books");
assertNotNull(sheet.getRow(0));
assertNotNull(sheet.getRow(0).getCell(0));
assertEquals(bookData[0][0], sheet.getRow(0).getCell(0).getStringCellValue());
-
+
wb2.close();
wb.close();
}
-
+
/**
- * Regression between 3.10.1 and 3.13 -
- * org.apache.poi.openxml4j.exceptions.InvalidFormatException:
- * The part /xl/sharedStrings.xml does not have any content type
+ * Regression between 3.10.1 and 3.13 -
+ * org.apache.poi.openxml4j.exceptions.InvalidFormatException:
+ * The part /xl/sharedStrings.xml does not have any content type
* ! Rule: Package require content types when retrieving a part from a package. [M.1.14]
*/
@Test
@@ -2868,30 +2863,29 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
double d = 3.0E-104;
assertEquals("3.0E-104", format.format(d));
*/
-
+
DataFormatter formatter = new DataFormatter(true);
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57236.xlsx");
- for(int sheetNum = 0;sheetNum < wb.getNumberOfSheets();sheetNum++) {
+ for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
Sheet sheet = wb.getSheetAt(sheetNum);
- for(int rowNum = sheet.getFirstRowNum();rowNum < sheet.getLastRowNum();rowNum++) {
+ for (int rowNum = sheet.getFirstRowNum(); rowNum < sheet.getLastRowNum(); rowNum++) {
Row row = sheet.getRow(rowNum);
- for(int cellNum = row.getFirstCellNum();cellNum < row.getLastCellNum();cellNum++) {
+ for (int cellNum = row.getFirstCellNum(); cellNum < row.getLastCellNum(); cellNum++) {
Cell cell = row.getCell(cellNum);
String fmtCellValue = formatter.formatCellValue(cell);
-
+
System.out.println("Cell: " + fmtCellValue);
assertNotNull(fmtCellValue);
assertFalse(fmtCellValue.equals("0"));
}
}
}
-
+
wb.close();
}
- private void createXls() throws IOException
- {
+ private void createXls() throws IOException {
Workbook workbook = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("/tmp/rotated.xls");
Sheet sheet1 = workbook.createSheet();
@@ -2947,7 +2941,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
Row row = worksheet.getRow(2);
Cell cell = row.getCell(1);
- cell.setCellValue((String)null);
+ cell.setCellValue((String) null);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
@@ -2987,7 +2981,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
workbook.close();
}
-
+
@Ignore("bug 59442")
@Test
public void testSetRGBBackgroundColor() throws IOException {
@@ -3006,12 +3000,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
Map properties = new HashMap();
properties.put(CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN); //or BorderStyle.THIN
CellUtil.setCellStyleProperties(cell, properties);
-
+
// Now the cell is all black
XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
assertNotNull(actual);
assertEquals(color.getARGBHex(), actual.getARGBHex());
-
+
XSSFWorkbook nwb = XSSFTestDataSamples.writeOutAndReadBack(workbook);
workbook.close();
XSSFCell ncell = nwb.getSheetAt(0).getRow(0).getCell(0);
@@ -3021,7 +3015,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
XSSFColor nactual = ncell.getCellStyle().getFillBackgroundColorColor();
assertNotNull(nactual);
assertEquals(ncolor.getARGBHex(), nactual.getARGBHex());
-
+
nwb.close();
}
@@ -3042,7 +3036,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals("Table1", tables.get(0).getName()); //FIXME: what is the table name?
assertEquals("Table2", tables.get(1).getName()); //FIXME: what is the table name?
}
-
+
@Test
public void test57523() {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57523.xlsx");
@@ -3052,21 +3046,21 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
int N = CellReference.convertColStringToIndex("N");
Cell N16 = row.getCell(N);
assertEquals(500.0, N16.getNumericCellValue(), 0.00001);
-
+
int P = CellReference.convertColStringToIndex("P");
Cell P16 = row.getCell(P);
assertEquals(10.0, P16.getNumericCellValue(), 0.00001);
}
-
+
/**
* Files produced by some scientific equipment neglect
- * to include the row number on the row tags
+ * to include the row number on the row tags
*/
@Test
public void noRowNumbers59746() {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("59746_NoRowNums.xlsx");
Sheet sheet = wb.getSheetAt(0);
- assertTrue("Last row num: "+sheet.getLastRowNum(), sheet.getLastRowNum()>20);
+ assertTrue("Last row num: " + sheet.getLastRowNum(), sheet.getLastRowNum() > 20);
assertEquals("Checked", sheet.getRow(0).getCell(0).getStringCellValue());
assertEquals("Checked", sheet.getRow(9).getCell(2).getStringCellValue());
assertEquals(false, sheet.getRow(70).getCell(8).getBooleanCellValue());
@@ -3087,54 +3081,54 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals("09 Mar 2016", result);
}
-
+
// This bug is currently open. When this bug is fixed, it should not throw an AssertionError
- @Test(expected=AssertionError.class)
+ @Test(expected = AssertionError.class)
public void test55076_collapseColumnGroups() throws Exception {
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();
-
+
// this column collapsing bug only occurs when the grouped columns are different widths
sheet.setColumnWidth(1, 400);
sheet.setColumnWidth(2, 600);
sheet.setColumnWidth(3, 800);
-
+
assertEquals(400, sheet.getColumnWidth(1));
assertEquals(600, sheet.getColumnWidth(2));
assertEquals(800, sheet.getColumnWidth(3));
-
+
sheet.groupColumn(1, 3);
sheet.setColumnGroupCollapsed(1, true);
-
+
assertEquals(0, sheet.getColumnOutlineLevel(0));
assertEquals(1, sheet.getColumnOutlineLevel(1));
assertEquals(1, sheet.getColumnOutlineLevel(2));
assertEquals(1, sheet.getColumnOutlineLevel(3));
assertEquals(0, sheet.getColumnOutlineLevel(4));
-
+
// none of the columns should be hidden
// column group collapsing is a different concept
- for (int c=0; c<5; c++) {
+ for (int c = 0; c < 5; c++) {
assertFalse("Column " + c, sheet.isColumnHidden(c));
}
-
+
assertEquals(400, sheet.getColumnWidth(1));
assertEquals(600, sheet.getColumnWidth(2));
assertEquals(800, sheet.getColumnWidth(3));
-
+
wb.close();
}
-
+
/**
* Other things, including charts, may end up taking drawing part
- * numbers. (Uses a test file hand-crafted with an extra non-drawing
- * part with a part number)
+ * numbers. (Uses a test file hand-crafted with an extra non-drawing
+ * part with a part number)
*/
@Test
public void drawingNumbersAlreadyTaken_60255() throws Exception {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("60255_extra_drawingparts.xlsx");
assertEquals(4, wb.getNumberOfSheets());
-
+
// Sheet 3 starts with a drawing
Sheet sheet = wb.getSheetAt(0);
assertNull(sheet.getDrawingPatriarch());
@@ -3144,17 +3138,17 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertNotNull(sheet.getDrawingPatriarch());
sheet = wb.getSheetAt(3);
assertNull(sheet.getDrawingPatriarch());
-
+
// Add another sheet, and give it a drawing
sheet = wb.createSheet();
assertNull(sheet.getDrawingPatriarch());
sheet.createDrawingPatriarch();
assertNotNull(sheet.getDrawingPatriarch());
-
+
// Save and check
wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
assertEquals(5, wb.getNumberOfSheets());
-
+
// Sheets 3 and 5 now
sheet = wb.getSheetAt(0);
assertNull(sheet.getDrawingPatriarch());
@@ -3190,8 +3184,8 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
str.close();
}
- assertEquals("B2:I5", ((XSSFSheet)sheet).getCTWorksheet().getDimension().getRef());
+ assertEquals("B2:I5", ((XSSFSheet) sheet).getCTWorksheet().getDimension().getRef());
wb.close();
}
-}
+}
\ No newline at end of file