Problem in fitting the excel cell size to the size of the content when using apache poi

前端 未结 1 1146
春和景丽
春和景丽 2021-02-01 04:21

I am beginner to Apache POI api. I am trying to create excel sheet using arraylist.

My java code is as follows.

HSSFWorkbook wb = new HSSFWorkbook();         


        
1条回答
  •  一向
    一向 (楼主)
    2021-02-01 04:51

    You just need to move the call to

    sheet.autoSizeColumn(5);
    

    to a point in your code after the data has been added, so right after your while loop should work.

    0 讨论(0)
提交回复
热议问题