xorcus Posted November 26, 2010 Share Posted November 26, 2010 Hi there,I'd like to create a pre-compiled report which can be both rendered on-screen (without pagination), and exported to pdf (with pagination). I found out that pagination is controlled with isIgnorePagination attribute in jasperReport tag.Is it possible (and how) to set value of isIgnorePagination attribute from Java code (e.g. using parameters) without recompiling the report?Thanks, xorcus Link to comment Share on other sites More sharing options...
svenn Posted November 26, 2010 Share Posted November 26, 2010 It would be great if this is possible. We ran into the same issue. Ended up creating two separate files, one for online and one for PDF display. Link to comment Share on other sites More sharing options...
jpauze Posted December 2, 2010 Share Posted December 2, 2010 Just doing a quick post to let you know that yes, this is possible and works extremely well. I am not in the office and this is a reminder for me follow up tomorrow on how to set the value programatically prior to executing the compiled report, no recompile needed.Once you set the pagination and execute, report can conditionally print based on intended output, it's a little bit more work designing each report but the outcome is you only need 1 report definition which will then support printing with or without pagination and don't have to maintain 2 copies. For my reports, if i display on screen in HTML then I disable all pagination, if the output is PDF or WORD etc, then i assume the intent is for printed content so the report has headers, footers with page numbers dates etc.. best of both worlds.Co-incidentally, in my implementation we execute the report and store the print object in a database, we then built a viewer which renders default html and allows the user to select various export formats such as PDF, WORD Etc. we then run the print object through the render engine in the appropriate format. Rendering print objects to different output formats is lightweight compared to generating the intial print object so quick access to various formats, the alternative is that you generate the report in HTML which depending on the report could be lengthy, then if you want to download as PDF you have to re-execute again, separating print object from render means you only have the gather the data once and then can output in whatever format you require. Link to comment Share on other sites More sharing options...
hussainkali Posted December 2, 2010 Share Posted December 2, 2010 Yes this can be done. I generate reports for Excel and PDF and use the following to enable/disable pagination. if (report format is xls) { params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); } else if (report format is pdf) { params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.FALSE); }then pass the parameter map (params) to the fill manager when creating the JasperPrint object.Hope this helps? Link to comment Share on other sites More sharing options...
gowda36 Posted November 30, 2012 Share Posted November 30, 2012 Where do i need to include i am using groovy language in ireport.. Link to comment Share on other sites More sharing options...
gowda36 Posted November 30, 2012 Share Posted November 30, 2012 if (report format is xls) { params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); } else if (report format is pdf) { params.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.FALSE); } How to write this code in groovy in ireport Link to comment Share on other sites More sharing options...
alexkorotkov89 Posted December 11, 2012 Share Posted December 11, 2012 You deal with this topic? Can you help me? How did you manage to do it? and where to put this code? Thank you very much Link to comment Share on other sites More sharing options...
steveo250k Posted March 20, 2014 Share Posted March 20, 2014 I wish someone would answer this. I have the same question, where does this code go. I'm using iReport and/or Studio. I'd like to give the user the option when running the report. I see similar posts that give this type of Java code, and it makes sense. But I have no clue how to implement it. Link to comment Share on other sites More sharing options...
krishna_2 Posted August 11, 2016 Share Posted August 11, 2016 $params->put("IS_IGNORE_PAGINATION",false); as you set parameters value like that only pass the value to this parameter. in your code of generating the pdf or excel file insert this code as per your condition. same as the parameter passing to the report.i have done it its working. IF some one know main jasper data change how to change margin in this data. i have change the isIgnorePagination. I am only able to change isIgnorePagination because its a parameter you can check in iReport. please let me know if you find anything Link to comment Share on other sites More sharing options...
krishna_2 Posted August 11, 2016 Share Posted August 11, 2016 $params->put("IS_IGNORE_PAGINATION",false);as you set parameters value like that only pass the value to this parameter.in your code of generating the pdf or excel file insert this code as per your condition.same as the parameter passing to the report.i have done it its working. IF some one know main jasper data change<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="iRpt_InvoiceAndPayment_MainRpt" language="groovy" pageWidth="1008" pageHeight="5000" whenNoDataType="NoDataSection" columnWidth="1008" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="5f68476c-1cc7-435d-b655-ffdc551ccf22">how to change margin in this data. i have change the isIgnorePagination.I am only able to change isIgnorePagination because its a parameter you can check in iReport. please let me know if you find anything 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