nirvanb Posted April 3, 2010 Share Posted April 3, 2010 I was trying to print a simple jasper report with a StaticText element in it. Here is my jrxml template.<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="FirstReport"> <detail> <band height="20"> <staticText> <reportElement x="20" y="0" width="200" height="20"/> <text> <![CDATA[Hello World of Jasper Reports]]> </text> </staticText> </band> </detail></jasperReport> and here is the java code that compiles and views the report InputStream is = DesignViewer.class.getResourceAsStream("/com/jrxml/FirstReport.jrxml"); JasperReport designFile = JasperCompileManager.compileReport(is); JasperPrint printFile = JasperFillManager.fillReport(designFile, new HashMap(), new JREmptyDataSource()); JasperViewer.viewReport(printFile); The code compiles and runs without any Exceptions. But the StaticText is not printed and I get an empty report. Why is it not displaying the StaticText.Note: When I view the jrxml template using JasperDesignViewer, I am able to see only the hollow rectangles (band) but StaticText is again not displayed.regards,Nirvan Link to comment Share on other sites More sharing options...
nirvanb Posted April 3, 2010 Author Share Posted April 3, 2010 For an EmptyDataSource, the attribute whenNoDataType="AllSectionsNoDetail" has to be set in order to avoid getting a blank report. cheersNirvan 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