public void testCleanColumns() {
    CTWorksheet worksheet = CTWorksheet.Factory.newInstance();

    CTCols cols1 = worksheet.addNewCols();
    CTCol col1 = cols1.addNewCol();
    col1.setMin(1);
    col1.setMax(1);
    col1.setWidth(88);
    col1.setHidden(true);
    CTCol col2 = cols1.addNewCol();
    col2.setMin(2);
    col2.setMax(3);
    CTCols cols2 = worksheet.addNewCols();
    CTCol col4 = cols2.addNewCol();
    col4.setMin(13);
    col4.setMax(16384);

    // Test cleaning cols
    assertEquals(2, worksheet.sizeOfColsArray());
    int count = countColumns(worksheet);
    assertEquals(16375, count);
    // Clean columns and test a clean worksheet
    ColumnHelper helper = new ColumnHelper(worksheet);
    assertEquals(1, worksheet.sizeOfColsArray());
    count = countColumns(worksheet);
    assertEquals(16375, count);
    // Remember - POI column 0 == OOXML column 1
    assertEquals(88.0, helper.getColumn(0, false).getWidth(), 0.0);
    assertTrue(helper.getColumn(0, false).getHidden());
    assertEquals(0.0, helper.getColumn(1, false).getWidth(), 0.0);
    assertFalse(helper.getColumn(1, false).getHidden());
  }
 private static int countColumns(CTWorksheet worksheet) {
   int count;
   count = 0;
   for (int i = 0; i < worksheet.sizeOfColsArray(); i++) {
     for (int y = 0; y < worksheet.getColsArray(i).sizeOfColArray(); y++) {
       for (long k = worksheet.getColsArray(i).getColArray(y).getMin();
           k <= worksheet.getColsArray(i).getColArray(y).getMax();
           k++) {
         count++;
       }
     }
   }
   return count;
 }