Note that there are some explanatory texts on larger screens.

plurals
  1. POApache POI Excel - how to configure columns to be expanded?
    primarykey
    data
    text
    <p>I am using <code>Apache POI API</code> to generate <code>excel spreadsheet</code> to output some data.</p> <p>The problem I am facing is when the spreadsheet is created and opened, columns are not expanded so that some long text like Date formatted text is not showing up on first glance.</p> <p>I could just double click the column border in excel to expand or drag the border to adjust the column width but there could be 20+ columns and there is no way I want to do that manually every time I open the spreadsheet :(</p> <p>I found out (though could be wrong method) <code>groupRow()</code> and <code>setColumnGroupCollapsed()</code> might be able to do the trick but no luck. Maybe I'm using it in wrong way.</p> <p><strong>Sample Code snippet</strong></p> <pre><code> Workbook wb = new HSSFWorkbook(); CreationHelper createHelper = wb.getCreationHelper(); //create sheet Sheet sheet = wb.createSheet("masatoSheet"); //not really working yet.... :( //set group for expand/collapse //sheet.groupRow(0, 10); //just random fromRow toRow argument values... //sheet.setColumnGroupCollapsed(0, true); //create row Row row = sheet.createRow((short)0); //put a cell in the row and store long text data row.createCell(0).setCellValue("Loooooooong text not to show up first"); </code></pre> <p><strong>When this spreadsheet is created, the "Looooooong text not to show up first" string is in the cell but since the column is not expanded only "Loooooooo" is showing up.</strong></p> <p>How can I configure it so that when I open my spreadsheet, the column is already expanded???</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload