Jump to content

want to fix column width in output HTML


guptaravi2k

Recommended Posts

Hi,

I want to fix the column width in output HTML report from jrxml file.

In case value in a cell has more characters I want output text in the column to be wrapped in next line instead of same line because that stratches the width of column therby making all column of that (increased/distorted)width.

I also notices following behavior:

if value of text is : "ravi ravi ravi ravi ravi ravi ravi ravi ravi ravi ravi ravi"

then output html report shows column value as

ravi ravi ravi

ravi ravi ravi

ravi ravi ravi

ravi ravi ravi

which is fine......

but if value is : "raviraviraviraviraviraviraviraviraviraviraviravi"

then output html shows column value as

raviraviraviraviraviraviraviraviraviraviraviravi

therby increasing column width to accomodate whole length.

how can i fix this problem in my jrxml file.

 

I am attaching sample jrxml file. in this i want to fix the width of column "Fabric Name" in output HTML file.

Please help me in this problem.

 Note: in PDF output file i am not facing such problem in this case text is automaticaly gets  wrapped into next line. I am confused why only HTML output is getting screwed.

thanks

Ravi Gupta



Post Edited by guptaravi2k at 05/13/2009 11:44
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

I do not know the exact answer to your question, but I would suggest you look at the API for the JRHtmlExporter and the JRHtmlExporterParameter classes. If there is any capability for instructing the exporter to use the exact column widths found in the JRXML file, it would be there. Just google "JRHtmlExporterParameter API" to find them.

 

Good luck.

Link to comment
Share on other sites

Take a look at these parameters:

 

    /**
     * A boolean value specifying whether the export engine should use force wrapping by breaking words (CSS <code>word-wrap: break-word</code>).
     */
    public static final JRHtmlExporterParameter IS_WRAP_BREAK_WORD = new JRHtmlExporterParameter("Is Wrap Break Word");


    /**
     * Property whose value is used as default state of the {@link #IS_WRAP_BREAK_WORD IS_WRAP_BREAK_WORD} export flag.
     * <p/>
     * This property is by default not set (<code>false</code>).
     *
     * @see JRProperties
     */
    public static final String PROPERTY_WRAP_BREAK_WORD = JRProperties.PROPERTY_PREFIX + "export.html.wrap.break.word";



Post Edited by andfedotov at 14/05/2009 05:47 PM
Link to comment
Share on other sites

  • 3 years later...

 Hi Lucian,

In our case, we are using jasperreports 1.2.7.jar and can't switch on to 3.5.1.jar!!. What can we do we to get word wraps? This issue has me scratching my head like anything.

Would appreciate some pointers in this regard.

Thanks in Advance.

Sandeep



Post Edited by sandeepkanabar at 08/05/2012 19:40
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...