Jump to content
We've recently updated our Privacy Statement, available here ×

JRBaseElement.getStyle() method returns null  


Recommended Posts

By: msprasanth - msprasanth

JRBaseElement.getStyle() method returns null Â

2006-01-11 09:08

Hello, Â

Â

I am trying to take the alignment from user and manipulate report at run-time using the Java API provided. Â

Â

jasperReport = JasperCompileManager.compileReport(jasperDesign);Â

JRBand detailBand = jasperReport.getDetail();Â

Â

JRBaseElement element = (JRBaseElement) detailBand.getElementByKey("name");Â

JRStyle alignment = element.getStyle();Â

Â

and alignment is NULL... because when i try to do a element.setX(50) its not throwing and exception but, when i try to do a alignment.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_LEFT)... it throws a NULLPOINTEREXCEPTION !! Â

Â

Any clue ??Â

Â

Thank you.Â

 

 

 

 

 

By: msprasanth - msprasanth

RE: JRBaseElement.getStyle() method returns null Â

2006-01-11 09:42

Wow... and look at this.... Â

Â

int w = 0;Â

int x = 0;Â

Â

for(no of columns){Â

Â

JRBaseElement element = (JRBaseElement) detailBand.getElementByKey("column"+"i");Â

Â

JRBaseElement header = (JRBaseElement) headerBand.getElementByKey("header"+"i");Â

Â

Â

element.setX(x);Â

header.setX(x);Â

Â

w = 585/(no.of.columns);Â

Â

element.setWidth(w);Â

header.setWidth(w);Â

x=x+(w+1);Â

Â

columns are column1, column2, column3.... etc., hence that for loopÂ

Â

Now, the report is printed diagonally... !!!! Â

Â

each row is printed diagonally (across the width) !! I dont know why..... I checked the Y value for each column and its still Zero ! (from top)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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