goompas Posted April 3, 2009 Share Posted April 3, 2009 HelloWhy i cant set forecolor and backcolor of element after filling ? page = (JRPrintPage) pages.get(i); elements = page.getElements(); List modifiedElements = new ArrayList(); if (element instanceof JRPrintText) { JRPrintText modifiedElement = ((JRPrintText) element); modifiedElement.setForecolor(Color.BLUE); modifiedElements.add(modifiedElement);} page.setElements(modifiedElements); Why this dont work? What should i do? Link to comment Share on other sites More sharing options...
lucianc Posted April 6, 2009 Share Posted April 6, 2009 The JRPrintText objects that result from a report fill do not implement these methods as they are optimized to store attributes common to other elements in shared objects. The objects should probably throw exceptions on unimplemented methods so that it's clear that this is not supported.If you want to perform this kind of processing on filled reports, a trick that helps is to go through an XML export in order to lose the fill optimizations. So do an JasperExportManager.exportReportToXml() and then read back the JasperPrint object from the XML export via JRPrintXmlLoader, and then process this object. Note that this will result in an increase of heap space required by the filled report.Regards,Lucian Link to comment Share on other sites More sharing options...
goompas Posted April 8, 2009 Author Share Posted April 8, 2009 Thanks for answerIs there any way to change dynamicly color of textfield element to any rgb? I know that can use styled text, but then numbers fields i must declare as string and when export to xls, excel dont see this numbers as numbers but strings. Link to comment Share on other sites More sharing options...
lucianc Posted April 8, 2009 Share Posted April 8, 2009 No, that's not possible. We have this on our radar, hopefully we'll implement a solution for it in the future.Regards,Lucian 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