Jasper文档没有页面 [英] Jasper the document has no page

查看:144
本文介绍了Jasper文档没有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用NetBeans的jasper报告插件。
我创建了我的连接(测试没问题)
我创建了jrxml
我尝试预览它。

I am trying the jasper report plugin with NetBeans. I created my connection (test is okay) I created the jrxml and I try to preview it.

它是编译的自动(出现.jasper)并且我有一条消息说:文档没有页面。

It is compiled automatically (the .jasper appears) and I have a message saying : "the document has no page".

我读到的问题可能是数据源为空但是它事实并非如此..所以我决定制作一个非常简单的jrxml(静态:只有文本而不引用数据库的任何字段)

I read the problem could be the datasource that is empty but it is not the case.. so I decided to make a very simple jrxml (static : only text with no reference to any field of the database)

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD JasperReport//EN"   "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

    <jasperReport name="report name" pageWidth="595" pageHeight="1500" columnWidth="535"  leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <background>
            <band/>
        </background>
        <title>
            <band height="79"/>
        </title>
        <pageHeader>
            <band height="35"/>
        </pageHeader>
        <columnHeader>
            <band height="61"/>
        </columnHeader>
        <detail>
          <band height="696">
            <textField isBlankWhenNull="false">
                <reportElement key="textField-23" x="0" y="274" width="449" height="134"/>
                <box>
                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                </box>
                <textElement textAlignment="Justified">
                    <font size="11" pdfFontName="Tiffy.ttf" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Vous avez reçu il y a quelques mois une attestation de la Caisse Primaire d'Assurance Maladie destinée à réduire le coût de votre adhésion à une complémentaire santé.\n\n"+
"Si vous rencontrez des difficultés dans vos démarches d'accès aux droits et aux soins, le Service social de l'Assurance Maladie est à votre disposition pour vous informer, vous conseiller et vous accompagner.\n\n" + 
"Aussi, je propose de vous rencontrer à votre domicile le : "]]>
                </textFieldExpression>
            </textField>
        </band>
      </detail>
    <columnFooter>
        <band height="45"/>
    </columnFooter>
    <pageFooter>
        <band height="54"/>
    </pageFooter>
    <summary>
        <band height="42"/>
    </summary>
</jasperReport>

同样认为它编译但是我有消息

same think it compiles but I have the message

所以我添加了这两行:

<noData>no Data</noData>
<queryString>select * from dual</queryString>

显然没有显示任何内容但是相同的消息..所以连接似乎没有?

Nothing is displayed obviously but the same message.. so connection seems alright no ?

推荐答案

即使报表正文中只有静态文本,如果报表的sql为空,则jasper默认不显示任何内容。尝试添加选择1作为虚拟作为您的查询,看看是否解决了它。

Even if you only have static texts in the body of your report, if your sql for the report is empty, jasper displays nothing by default. Try adding "select 1 as dummy" as your query and see if that solves it.

这篇关于Jasper文档没有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆