shamphadtale Posted January 4, 2012 Share Posted January 4, 2012 As static text does not streach and my column names are going to vary I am trying to use Text Field as column header.How should I set text to it? I am doing as shown in below code where col.getTitle() gives column header to be shown, but I am getting exception as follow - net.sf.jasperreports.engine.JRException : Errors were encountered when compiling report expressions class file:Is anyone have idea about how to fix this issue?1. Syntax error on token "Name", delete this tokenvalue = Device Name; //$JR_EXPR_ID=26$<-->Code:JRDesignTextField staticText = new JRDesignTextField(); staticText.setX(initX); staticText.setY(initY); staticText.setWidth(col.getWidth() + widthAdjustment); staticText.setHeight(HEADER_BAND_HEIGHT); staticText.getLineBox().setLeftPadding(3); staticText.getLineBox().setRightPadding(3); staticText.setPrintWhenDetailOverflows(true); staticText.setStretchType(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT); staticText.setMode(ModeEnum.OPAQUE); staticText.setBackcolor(headerColor); col.getHeaderStyle().getLinePen().setLineWidth(0); headerStyle = col.getHeaderStyle(); staticText.setStyle(headerStyle); staticText.setHorizontalAlignment(HorizontalAlignEnum.CENTER); staticText.setStretchWithOverflow(true); JRDesignExpression expression1 = new JRDesignExpression(); expression1.setValueClass(String.class); expression1.setText(col.getTitle()); staticText.setExpression(expression1); //staticText.setText(col.getTitle()); headerBand.addElement(staticText); 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