-1
こんにちは.jrxmlファイルのこのコードサンプルがあります。Javaからjrxmlファイルにデータを入れる方法は?
<staticText>
<reportElement x="69" y="10" width="422" height="180" uuid="52dc00c8-2cd3-466e-bc37-9dde8d5da625"/>
<textElement textAlignment="Justified" markup="html">
<font size="11"/>
<paragraph lineSpacing="1_1_2"/>
</textElement>
<text><![CDATA[I HAVE THINGS HERE]]></text>
</staticText>
テキストタグには、Javaクラスからの文字列が必要です。それ、どうやったら出来るの?ここ は、Javaコードは次のとおりです。
public static void main(String[] args) {
try {
JasperReport jasperReport = JasperCompileManager
.compileReport("src/main/resources/EJA1.jrxml");
Long now = new Date().getTime();
Map parameters = new HashMap();
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint,
"src/main/resources/reports/teste" + now.toString() + ".pdf");
} catch (JRException e) {
e.printStackTrace();
}
}
ありがとう!
あなたは、パラメータとTextFieldを使用することができます –