Free Support Forum - aspose.com

Columns width not auto extending in all but last fields of tpye ROW in pivot table

Hello,

I’m evaluating Aspose Cells fro Java 2.1.1 (JDK 5.0). I tried the pivot table example, described at step 4 in this document http://www.aspose.com/documentation/java-components/aspose.cells-for-java/create-pivot-tables-and-pivot-charts.html
The only modification I made was instead of
pivotTable.setAutoFormatType(PivotTableAutoFormatType.REPORT6);
I used
pivotTable.setAutoFormatType(PivotTableAutoFormatType.CLASSIC);


I noticed that all fields, except the last one, of type PivoFieldTable.ROW did not extend to their maximum content width.

Is this a bug or I need to do something (not mentioned in the example above) explicitly in order to get all columns’ width auto extended to match the content?

Thanks in advance,
Tihomir Slavkov

Hi Tihomir,

Well, it is not a bug by any means, if you could create a pivot table manually in MS Excel (with CLASSIC auto-format type), you can see the columns widths are not auto-formatted in the pivot table report. The columns are rendered with default (8.43) width. As a work-around, you may try to extend the columns width a bit for your need.

e.g

//Extend widths a bit for the B and C columns.
sheet2.setColumnWidth(1,11);
sheet2.setColumnWidth(2,15);


Thank you.

Hi Amjad,

Thank you for your quick support. The workaround, which you suggested, works perfectly for me.

Regrads,
Thiomir Slavkov