2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now