For people like me who don't use JasperSoft or older iReport and work directly with XML, follow these steps:
<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" whenNoDataType="NoDataSection" name="freport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
Add whenNoDataType="NoDataSection" to the <jasperReport> element.
<noData> <band height="15"> <staticText> <reportElement x="0" y="0" width="200" height="15"/> <box> <bottomPen lineWidth="1.0" lineColor="#CCCCCC"/> </box> <textElement /> <text><![CDATA[The report has no data]]> </text> </staticText> </band> </noData>
Add the <noData> element below the part range.
source share