Jump to content
Changes to the Jaspersoft community edition download ×

Dose jasper able to eliminate white space???

2005 IR Help

Recommended Posts

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.







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?









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();


PrintWriter out = response.getWriter();

datacon mdtcon=new datacon();



File reportFile = new File(context.getRealPath("/reports/Customers.jasper"));


JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath());


Map parameters = new HashMap();


from = request.getParameter("textfrom");

to =request.getParameter("textto");

parameters.put("code", from);

parameters.put("codetwo", to);

JasperPrint jasperPrint =






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.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);



catch (JRException e)





out.println("<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">");


out.println("<body bgcolor="white">");

out.println("<span class="bnew">JasperReports encountered this error :</span>");











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);







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

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