Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to print staticText


nirvanb

Recommended Posts

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

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