I have some Jasper reports which are displayed in HTML format. I would like the width of the columns in the HTML tables to automatically resize to fit the content of the wid
In iReport there is an option called "Stretch Type". Select "Relative to Band Height"
The developers made a conscious decision to not allow cell width to stretch. For columns to change their width based on the content, it must be done through programming. A helpful tool: DynamicJasper.
DynamicJasper creates reports dynamically, defining at runtime the columns, column width (auto width), groups, variables, fonts, charts, crosstabs, sub reports (that can also be dynamic), page size and everything else that you can define at design time.
While not perfect, you could flag the field to stretch with overflow. This would at least give you all the data. In your jrxml file it would be similar to:
<textField isStretchWithOverflow="true" hyperlinkType="None">
<reportElement style="Report Sub-Title" x="0" y="84" width="802" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String">
<![CDATA["For the period ...]]>
</textFieldExpression>
</textField>
I'm afraid I don't know of any feature of Jasper reports that would allow the dynamic resizing of column widths - It is probably one of those things that makes sense for HTML but little sense for other output formats such as PDF.