Jump to content

Conditional Style not working after compiling with JasperDesign object using java or programatically


Recommended Posts

I am trying to add conditional style programatically with existing reort. When I compilling with jasperdesign object it wont reflect any style in PDF. But same if i first write into JRXML and again load and compiling the it will work. ( see my commented lines those line works but why not with the same object)

See below code it wont work:

JasperDesign jasDes = new JasperDesign();

            logger.info("Loading JRXML into Jasper Design: [" + rptPath + "]");
            jasDes = JRXmlLoader.load(rptPath);

            JRDesignGroup jrDesignGroup = new JRDesignGroup();
            JRExpression jrExpression = new JRDesignExpression("$F{pgno}");

            JRDesignStyle designStyle = new JRDesignStyle();
            jrExpression = new JRDesignExpression("$F{reclvl}.equals("B")");
            JRDesignConditionalStyle conditionalStyle = new JRDesignConditionalStyle();

//            String temp = JRXmlWriter.writeReport(jasDes, JRXmlTemplateWriter.DEFAULT_ENCODING);

//         JasperReport jasperReport = JasperCompileManager.compileReport(new ByteArrayInputStream(temp.getBytes());
            JasperReport jasperReport = JasperCompileManager.compileReport(jasDes);
            JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
            JasperExportManager.exportReportToPdfFile(jasperPrint, exportPath);

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