Jump to content

Dynamic width of a Textfied - with Parameter ??


kolja.ehlersiconplc.com

Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Element widths cannot be changed via report parameters or other type of dynamic expressions.

The only way of doing this is to use the JasperReports API by change the element width before filling the report.  You would have to locate the specific JRElement instance in the JasperReport object and call setWidth on the element.  Note that you would have to do this before starting to fill the report/subreport.

Regards,

Lucian

Link to comment
Share on other sites

  • 6 months later...

See  below.

Regards,

Lucian

Code:
JasperDesign design = xmlLoader.loadXML(..jrxmlStream..);JRElement[] elements = design.getDetail().getElements();String elementKey = ..key of element to modify..;int newWidth = ..new element width..;for (int i = 0; i < elements.length; i++){	JRDesignElement element = (JRDesignElement) elements[i];	if (elementKey.equals(element.getKey()))	{		element.setWidth(newWidth);	}}
Link to comment
Share on other sites

  • 4 weeks later...

Hi Lucian,

Could you explain in clearly the code that you have wriiten, i have a requirement to set page height, page width of the report dynmaically.

Could you write the code that i need to integrate it my requirement.

Thanks,

Naveen Chanda

 

 

Link to comment
Share on other sites

naveenjava
Wrote:

Could you explain in clearly the code that you have wriiten, i have a requirement to set page height, page width of the report dynmaically.

Could you write the code that i need to integrate it my requirement.

If you want to change the report page heitght and width see the JasperDesign.setPageWidth() and setPageHeight() methods.

Regards,

Lucian

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...