title: How to show/hide a column at runtime?
body: <p>I'd like to show/hide a column at runtime based on a particular condition. I'm using "Print when expression" to conditionally show/hide this column (and it's header) in my report. When the column is hidden, the space it would have occupied is left blank, which is not particularly attractive.</p>
  
  <p>I would prefer if the extra space was used in a more effective manner, possibilities include:</p>
  
  <ul>
  <li>the width of the report is reduced by the width of the hidden column</li>
  <li>the extra space is distributed among the remaining columns</li>
  </ul>
  
  <p>In theory, I could achieve the first by setting the width of the column (and header) to 0, but also indicate that the column should resize to fit its contents. But JasperReports does not provide a "resize width to fit contents" option.</p>
  
  <p>Another possibility is to generate reports using the Jasper API instead of defining the report template in XML. But that seems like a lot of effort for such a simple requirement.</p>