Automatic column width

Is there a way to specify that a column's width is to be sized automatically? I like and use that feature a lot in Excel.

I'm using the latest Java-based version.

Hi,

Please try this fix. You can get this property by calling Column..isUsingDefaultWidth() method,see following codes:

Columns columns = cells.getColumns();

Column column = columns.getColumn(0);

if(column.isUsingDefaultWidth(){

....................

}

The Column class does not include any methods associated with default width.

Also, I'm far more interested in getting the property than in setting it.

Hi,

The attached zip is the newest java-doc.

Column.isUsingDefaultWidth() is used to get whether the column width is auto sized.

I can't seem to get this function work for me. What I am trying to do is have the columns set to the AutoWidth. This would mimic double-clicking on the column separators above the first row, to make the columns only wide enough to fit their contents.

This is done with the Excel com object using Excel.Worksheet.Columns.Autofit

I tried using the following code before and after writing the data, but neither would change the column width.

// Set AutoWidth
cells.getColumns().getColumn(0).setUseDefaultWidth( true );
cells.getColumns().getColumn(1).setUseDefaultWidth( true );

Hi,

This autofit feature is not supported now.

Will this be supported in a future release? It is very useful when saving dynamic ad-hoc queries to Excel.

Hi,

We will support this feature.It will take us 1-2 month to do.Thank you for your patience.