Friday, February 25, 2011

Wrapping long text in Pentaho html reports in IE7

   To understand the issue just open pentaho demo report in IE7 and for comparation in FF of Chrome.
   The report is located in Steel Wheels/Reporting and is called "Order Status". It contain a long line of text which is not wrapped in IE7 and wrapped in other browsers.

   Internet Explorer 7:
   Firefox:
   There should be a dozen of ways to wrap this text, but I want to show how simple it can be resolved with CSS.
   Actually Pentaho report engine do a lot of things to wrap the long line: it sets <table> element with, <col> elements widths, it even wrap each line of data into span element. But IE7 just write it in single line.
   One promissing way to overcome this was to use table-layout:fixed css style. But this not helps because pentaho also have fixed height of rows. And data just trancates without moving to the next line.
   My solution is to apply block style to all spans in the table:
  table td span {
   display:block;
  }
   It simple and it works like a charm. If you need you can empower the rule with more strict constraints to keep other tables save.