pinkStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
assertEquals(2, pinkStyle.getIndex());
// Starts empty
assertEquals(1, s.getCTWorksheet().sizeOfColsArray());
CTCols cols = s.getCTWorksheet().getColsArray(0);
assertEquals(0, cols.sizeOfColArray());
// Add some rows and columns
XSSFRow r1 = s.createRow(0);
XSSFRow r2 = s.createRow(1);
r1.createCell(0);
r1.createCell(2);
r2.createCell(0);
r2.createCell(3);
// Check no style is there
assertEquals(1, s.getCTWorksheet().sizeOfColsArray());
assertEquals(0, cols.sizeOfColArray());
assertEquals(defaultStyle, s.getColumnStyle(0));
assertEquals(defaultStyle, s.getColumnStyle(2));
assertEquals(defaultStyle, s.getColumnStyle(3));
// Apply the styles
s.setDefaultColumnStyle(0, pinkStyle);
s.setDefaultColumnStyle(3, blueStyle);
// Check
assertEquals(pinkStyle, s.getColumnStyle(0));
assertEquals(defaultStyle, s.getColumnStyle(2));
assertEquals(blueStyle, s.getColumnStyle(3));
assertEquals(1, s.getCTWorksheet().sizeOfColsArray());
assertEquals(2, cols.sizeOfColArray());
assertEquals(1, cols.getColArray(0).getMin());
assertEquals(1, cols.getColArray(0).getMax());
assertEquals(pinkStyle.getIndex(), cols.getColArray(0).getStyle());
assertEquals(4, cols.getColArray(1).getMin());
assertEquals(4, cols.getColArray(1).getMax());
assertEquals(blueStyle.getIndex(), cols.getColArray(1).getStyle());
// Save, re-load and re-check
wb = XSSFTestDataSamples.writeOutAndReadBack(wb);
s = wb.getSheetAt(0);