Ajenjo Posted May 26, 2011 Share Posted May 26, 2011 Hi.I have a subreport with 3 columns. Depending on the user's action is hidden some of the columns.My question is, how I can be able to hide or show columns in runtime for these reports?I do it with this code: File sourceFile = new File(rootJasperFiles + "RequestProposal_Products.jasper"); JasperReport sourceJasperReport = (JasperReport)JRLoader.loadObject(sourceFile); JRStaticText unitsLabelBox = (JRStaticText)sourceJasperReport.getColumnHeader().getElementByKey("unitslabel.box"); unitsLabelBox.setWidth(0); JRTextField unitsLabelTextField = (JRTextField)sourceJasperReport.getColumnHeader().getElementByKey("unitslabel.textfield"); unitsLabelTextField.setWidth(0); JRBand[] jrbands = (JRBand[])sourceJasperReport.getDetailSection().getBands(); JRFrame unitsFrame = (JRFrame)jrbands[0].getElementByKey("units.frame"); unitsFrame.setWidth(0); JRTextField unitsTextField = (JRTextField)jrbands[0].getElementByKey("units.textfield"); unitsTextField.setWidth(0); jasperPrint = JasperFillManager.fillReport(rootJasperFiles + "RequestProposal.jasper", pars, dataSource); But no works, I think that the subreport has the changes but I fill the "parent" report with no changes ¿?¿?¿?Can you help me, thanks. 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