2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: sepi - sepideh Dose jasper able to eliminate white space??? 2004-06-23 06:54 I asked many time,I just want to be sure that if Japer is not able to do that we should think about something else,because in my report there are lots of places which if there is no data I want to remove white space and shift the other data up,which is a noraml action in all reports. Plaese let me know,If anybody has any idea about that. Thanks, By: sepi - sepideh RE: Dose jasper able to eliminate white space??? 2004-06-23 10:50 Where should I call this method? should i call it after filling the report with jasper? Is exporter a jasper class? Can you give me more information? Thanks, By: karthika - karthika RE: Dose jasper able to eliminate white space??? 2004-06-23 23:10 import dori.jasper.engine.*; import dori.jasper.engine.util.*; import dori.jasper.engine.export.*; import java.sql.*; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class html extends HttpServlet { public void service( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { ServletContext context = this.getServletConfig().getServletContext(); response.setContentType("text/html"); PrintWriter out = response.getWriter(); datacon mdtcon=new datacon(); try { File reportFile = new File(context.getRealPath("/reports/Customers.jasper")); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath()); Map parameters = new HashMap(); response.setContentType("text/html"); from = request.getParameter("textfrom"); to =request.getParameter("textto"); parameters.put("code", from); parameters.put("codetwo", to); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, parameters, mdtcon.getDBConnection() ); JRHtmlExporter exporter = new JRHtmlExporter(); Map imagesMap = new HashMap(); request.getSession().setAttribute("IMAGES_MAP", imagesMap); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="); exporter.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML,""); exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporter.exportReport(); } catch (JRException e) { out.println("<html>"); out.println("<head>"); out.println("<title>JasperReports</title>"); out.println("<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">"); out.println("</head>"); out.println("<body bgcolor="white">"); out.println("<span class="bnew">JasperReports encountered this error :</span>"); out.println("<pre>"); e.printStackTrace(out); out.println("</pre>"); out.println("</body>"); out.println("</html>"); } } its a sample from jasper By: karthika - karthika RE: Dose jasper able to eliminate white space??? 2004-06-23 09:44 exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); TRY THIS By: Chuck Deal - cdeal RE: Dose jasper able to eliminate white space??? 2004-06-24 05:12 This solution is only appropriate when exporting to HTML. THis does not actually answer the problem posted. JasperReports does have an attribute that handle the act of collapsing whitespace (I don't remember the attribute name). The problem is that there cannot be anything else in the horizontal space occupied by the element that should collapse. If there is, the row won't collapse. A test to show this would be to have a simple report that had stacked text fields. In one of the text fields supply a blank (make the the attribute is set properly) When you run the report the text field that was blank will collapse. If you can successfully make this report, you will prove that Jasper can handle this need. You will just need to adjust your own report design. 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