0

I've copied the loop used and working to autosize columns in HSSFSheet, but for XSSFSheet the cell that is using to adjust the column is not the one wider. This results in columns with "0" width.

XSSFSheet xssfSheet = null;
.....
for (short c = 0; c<11; c++){
    xssfSheet.autoSizeColumn(c);
}

Thanks in advance!

Edit: this is done at the very end of the method, no data is added. The problem seems to be that it autosizes to the contents of the last cell added in each column

Sanjo
  • 78
  • 8
  • 1
    they are auto sized to the size of their content. if they have no content, it will autosize to 0 probably – XtremeBaumer Feb 07 '17 at 11:50
  • Do you autosize columns after you inserted their content? I had this problem long ago. I will post my solution in 9 hours (after work). – Yan Khonski Feb 07 '17 at 11:57

1 Answers1

2

Please make sure to add text in the column before applying autosize column on it.

Raheem
  • 67
  • 1
  • 9