gpt4 book ai didi

jasper-reports - Jasper Reports中的图像表达URL

转载 作者:行者123 更新时间:2023-12-03 11:33:47 31 4
gpt4 key购买 nike

我想将图像嵌入到我的JasperReports jrxml文件中。我有这个目录结构。

Tomcat Root
webapps
reports
-->images
--> company_logo.jpg
-->reports
-->sample.jasper
-->WEB-INF
-->classes

我尝试这样做是因为这与我的报告上下文根相关

<image>
<reportElement x="0" y="0" width="104" height="40"/>
<imageExpression class="java.lang.String">
<![CDATA["images/company_logo.jpg"]]>
</imageExpression>
</image>

..这也是

<image>
<reportElement x="0" y="0" width="104" height="40"/>
<imageExpression class="java.lang.String">
<![CDATA["/images/company_logo.jpg"]]>
</imageExpression>
</image>

但是它总是说从 JRLoader位置加载字节时出错。

我尝试这样做,但是它很有效,但是我有点困惑为什么我的前两次尝试都没有。

这真的是您在JasperReports中嵌入图像的方式吗?您需要提供整个路径吗?我认为应该有一个相对页面
的东西。

<image>
<reportElement x="0" y="0" width="104" height="40"/>
<imageExpression class="java.lang.String">
<![CDATA["http://localhost:8080/reports/images/company_logo.jpg"]]>
</imageExpression>
</image>

我对正确的方法感到困惑。

最佳答案

<![CDATA["../images/company_logo.jpg"]]>应该可以解决问题。该路径是相对于您的.jasper文件的。

关于jasper-reports - Jasper Reports中的图像表达URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3623420/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com