免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Java-Jasper報(bào)告空白頁(yè)

我的jrxml和Java代碼如下.我正在嘗試使用一些文本和值創(chuàng)建報(bào)告.但是,將生成空白報(bào)告.我正在粘貼地圖以將報(bào)告填充為參數(shù).我必須添加4-5條靜態(tài)行,然后添加一個(gè)動(dòng)態(tài)變量.我在詳細(xì)的樂(lè)隊(duì)中添加了這些東西.錯(cuò)了什么

    <?xml version="1.0" encoding="UTF-8"  ?>    <!-- Created with iReport - A designer for JasperReports -->    <!DOCTYPE jasperReport PUBLIC "http://JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">    <jasperReport             name="Untitled_report_2"             columnCount="1"             printOrder="Vertical"             orientation="Portrait"             pageWidth="595"             pageHeight="842"             columnWidth="535"             columnSpacing="0"             leftMargin="30"             rightMargin="30"             topMargin="20"             bottomMargin="20"             whenNoDataType="NoPages"             isTitleNewPage="false"             isSummaryNewPage="false">        <property name="ireport.scriptlethandling" value="0" />        <property name="ireport.encoding" value="UTF-8" />        <import value="java.util.*" />        <import value="net.sf.jasperreports.engine.*" />        <import value="net.sf.jasperreports.engine.data.*" />        <field name="Field" class="java.lang.String"/>            <background>                <band height="0"  isSplitAllowed="true" >                </band>            </background>            <title>                <band height="50"  isSplitAllowed="true" >                </band>            </title>            <pageHeader>                <band height="50"  isSplitAllowed="true" >                </band>            </pageHeader>            <columnHeader>                <band height="30"  isSplitAllowed="true" >                </band>            </columnHeader>            <detail>                <band height="100"  isSplitAllowed="true" >                    <staticText>                        <reportElement                            x="20"                            y="10"                            width="180"                            height="30"                            key="staticText-1"/>                        <box></box>                        <textElement>                            <font/>                        </textElement>                    <text><![CDATA[4-5 lines text]]></text>                    </staticText>                    <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >                        <reportElement                            x="20"                            y="40"                            width="60"                            height="20"                            key="textField-1"/>                        <box></box>                        <textElement>                            <font/>                        </textElement>                    <textFieldExpression   class="java.lang.String"><![CDATA[$F{Field}]]></textFieldExpression>                    </textField>                    <staticText>                        <reportElement                            x="20"                            y="70"                            width="160"                            height="30"                            key="staticText-2"/>                        <box></box>                        <textElement>                            <font/>                        </textElement>                    <text><![CDATA[4-5 lines text]]></text>                    </staticText>                </band>            </detail>            <columnFooter>                <band height="30"  isSplitAllowed="true" >                </band>            </columnFooter>            <pageFooter>                <band height="50"  isSplitAllowed="true" >                </band>            </pageFooter>            <lastPageFooter>                <band height="50"  isSplitAllowed="true" >                </band>            </lastPageFooter>            <summary>                <band height="50"  isSplitAllowed="true" >                </band>            </summary>    </jasperReport>

Java代碼:

    InputStream fileInput = getApplicationContext().getResource("/WEB-INF/reports/myjrxml.jrxml").getInputStream();    JasperReport jasperReport = JasperCompileManager.compileReport(fileInput);    HashMap map = new HashMap();    map.put("Field", "test");    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map);    byte[] output1 = JasperExportManager.exportReportToPdf(jasperPrint);     String filename = "d:/test.pdf";    FileOutputStream fo = new FileOutputStream(filename);    fo.write(output1);    fo.close();

解決方法:

您正在將報(bào)告數(shù)據(jù)與參數(shù)混淆.我看不到您有任何報(bào)告數(shù)據(jù),這就是為什么您得到空?qǐng)?bào)告的原因.此外,您要填充一個(gè)名為“ Field”的參數(shù),而不是實(shí)際的報(bào)告數(shù)據(jù).因此,您需要在報(bào)表中創(chuàng)建一個(gè)名為“字段”的參數(shù),然后在詳細(xì)信息區(qū)域中對(duì)其進(jìn)行引用,或者您需要將報(bào)表數(shù)據(jù)傳遞到報(bào)表中,例如

JRBeanCollectionDataSource data = new JRBeanCollectionDataSource(dataSet);jasperPrint = JasperFillManager.fillReport(jasperReport, parameterMap, data);

其中dataSet是一個(gè)集合,例如List<?>.在列表中,您將擁有一個(gè)對(duì)象,其中屬性之一是字段.

來(lái)源:https://www.icode9.com/content-1-519251.html
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Getting Started With JasperReports
JasperReport查看和打印報(bào)告
jasperreports表報(bào)
一次 applet 客戶端打印 jasperreport 報(bào)表任務(wù)筆記
ireport導(dǎo)出各種格式(pdf,excel,word,html,print)
圖示ireport中使用javabean作數(shù)據(jù)源開發(fā)基于jasperreports報(bào)表過(guò)程
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服