Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: HTML JTextPane in reports

  1. #1

    Default HTML JTextPane in reports


    I have a very large JTextPane which displays HTML and I want to be able to put it into a multi-page report. I'm using version Is there an example of how to do this with the API?


  2. #2
    Join Date
    Mar 2003


    Use a Component-Field and add your Swing-Component as report-property or inside the tablemodel. The ComponentDrawingDemo ( shows how to do this using XML.

    For API uses, use the "ComponentFieldElementFactory" to define your element:

        final ComponentFieldElementFactory cfef = new ComponentFieldElementFactory();
        cfef.setMinimumSize(new FloatDimension(400, 400));
        cfef.setAbsolutePosition(new Point2D.Float(0,0));
        final Element yourElement = cfef.createElement();
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3


    your reply is absolutely correct but i asked the wrong question. the real question is, can i pass in a couple pages worth of HTML into JFreeReport using the API?

    btw, thanks for all your help over the past couple of days.


  4. #4
    Join Date
    Mar 2003


    Not HTML, but version 0.8.9 does have the technical ability of displaying rich-text.

    For far we did not announce this capability, as we still have not found a sensible user-model for rich-text. HTML is maybe one of the worst options - it is not only ill-defined, ambiguous, irregular, insanely complex, hard to parse and even harder to display correctly, overloaded with old and deprecated features and no two HTML processors could agree on how to display a page properly. RTF is slightly better, although the later incarnations copied a lot of the sickness of HTML's complexity.

    So if you manage to translate your HTML text into plain bands and elements, then you will be fine. For inline-elements (HTML: <span>, <font>, <b> etc) you can tell the band to have a "inline" layout, for block elements (HTML: <div>, <p>) use a band with layout-mode "block". However, for dynamic text you might have to employ a custom Function to add the elements to the report.

    A sensible rich-text element that shields you from the manual conversion work is scheduled for 0.8.11. There we will most likely use some sort of simplified (say: welldefined) HTML. For the full-featured HTML and RTF, we will most likely fall back to the Swing-parsers or something home-grown (if the swing-parsers are so slow or creepy that they become unusable).
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  5. #5


    thanks for your reply!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.