ALBERLAU blog

Blog about my personal experience in software development.

Friday, February 01, 2008

 

JasperReports issues

Textfield border is not visible when rendering empty string using html exporter
When drawing table in JasperReports i'm not using lines, but placing text or static fields with borders set on them. Problem occures when there is empty string. Border is not rendered then. I think it is common problem to html, because in html tables you need to place & n b s p ; . In JasperReports nbsp will be rendered as nbsp in pdf exporter as well in html. If cell is empty you can place space instead of empty string. But what in case BigDecimal, Date or some other type?
The source causing this problem is in net.sf.jasperreports.engine.export.JRHtmlExporter .
emptyCellStringProvider =
new StringProvider()
{
public String getStringForCollapsedTD(Object value, int width, int height, String sizeUnit)
{
return " style=\"width: " + width + sizeUnit + "; height: " + height + sizeUnit + ";\">";
}
public String getStringForEmptyTD(Object value)
{
return "";
}
};

It is not possible to specify other emptyCellStringProvider. At least in 1.3.4 and 2.0.4 versions.
I think the line returning empty string should look as follows:
public String getStringForEmptyTD(Object value)
{
return " ";
}


Unfortunately i was unable to findout other way than to download sources, fix problem and make jar by myself.

Labels:


Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

Archives

January 2008   February 2008   March 2009  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]