- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在使用 JasperReport 模板生成电子邮件内容时遇到问题。我需要内容位于带边框的内容内并具有图像 但在我生成加载内容的模板后,它在 gmail 或 zimbra 邮件中看起来并不像这样: 正如您所看到的,结果与 JasperSoft Studio 中的预览不同。
我想知道是否有办法确保图像正确加载并且边框包含模板的其余部分
图像的碧 Jade block :
<image scaleImage="RealSize" hAlign="Center" vAlign="Middle" isLazy="true">
<reportElement x="160" y="50" width="240" height="130" isRemoveLineWhenBlank="true" uuid="e72e685c-99f5-4dff-9174-2e25cab4a899"/>
<graphicElement fill="Solid"/>
<imageExpression><![CDATA["(https://domain/fe-standalone/files/resource/image.png)"]]></imageExpression>
</image>
模板生成的java代码:
protected void exportToHTML(String jasperPath, ExportParams params, Connection connection, ByteArrayOutputStream baos) throws SQLException, JRException {
try {
Map<String, Object> parameters = new HashMap<>();
parameters.putAll(params.getParameters());
JasperPrint jasperPrint = fillReport(getClass().getResourceAsStream(jasperPath), parameters, connection);
SimpleHtmlExporterOutput oseo = new SimpleHtmlExporterOutput(baos);
HtmlExporter exporter = new HtmlExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(oseo);
exporter.setConfiguration(new SimpleHtmlExporterConfiguration());
exporter.exportReport();
connection.close();
} catch (JRException e) {
connection.close();
throw new JRException(e);
}
}
最佳答案
您可以做的一件事是将 isUseBackgroundImageToAlign
导出标志设置为 false。如
SimpleHtmlReportConfiguration configuration = new SimpleHtmlReportConfiguration();
configuration.setUseBackgroundImageToAlign(false);
exporter.setConfiguration(configuration);
您还可以通过 net.sf.jasperreports.export.html.use.background.image.to.align 设置标志配置属性。
但请注意,这可能会导致图像不再根据 scaleImage、hAlign 和 vAlign 属性进行对齐,因此您需要将 JRXML 图像元素尺寸设置为您希望图像具有的大小。
关于java - 电子邮件的 JasperReport 模板中未加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58441873/
我的 pom 中有以下插件: org.codehaus.mojo jasperreports-maven-plugin
我试图让 JasperReports 嵌入 JasperReports 字体 jar 中存在的字体(来自 DynamicJasper 生成的报告)。我在 jasperreports.propertie
我们在刚下载的 TomEE 应用服务器中出现了奇怪的行为。我们的情况:我们正在运行两个应用程序(我们称之为 v1 和 v2),它们通过使用 JasperReports 的 REST API 为我们提供
当jasperreport在java应用程序中导出为.pdf时,我们如何设置jasperreport的字体。 最佳答案 我需要将西里尔字体导出到 jasperreport 中以生成 pdf。字体必须包
我正在使用 Java 生成 jasper 报告。它有一个学生 bean,其中包含 College_name 和学生信息列表(第二个 bean)。Student_info包含student_Name和地
我正在升级标题中提到的 JasperReports 版本。JasperReports 版本升级我不是很了解。我必须更改所有内容才能使其正常工作。我有所有内容的最新 .jar 文件。但是当我打印我的 .
我想通过 Java 打印 JasperReports 的报告。 所以我写了如下代码 try { String r ="C:\\ireport\\Foods.jrxml";
尝试在 WebLogic 11g 上导出时,它会引发 NoClassDefFound 异常。我检查了应用程序 WAR 并且 jasperreports-3.7.4.jar 包含在 WEB-INF/li
我正在使用 GWT 构建一个网站,我想使用 JasperReports 在网站中加入一个报告生成器。报告绘制的所有数据都存储在云中的数据库中,因此我使用实例和云 sql 连接到数据库并检索/存储数据(
我想分享我对 JasperReports 或多或少常见错误的经验。 在执行JasperReports制作PDF报表时出现异常: java.lang.NoClassDefFoundError: Coul
我正在使用 grails 版本 2.4.0 和 JasperReports 插件:1.9.0(也尝试过版本 jasper-1.10.0-SNAPSHOT),但是当我导出到 pdf 时出现错误。 当我第
我正在尝试使用 java 代码从 jrxml 文件制作 pdf,但它给了我以下错误: SEVERE: Parse Error at line 2 column 487: Document root e
我在 docker openjdk:11.0.1-jdk-slim 内运行 jasperreports 没有错误。 内部openjdk:11.0-jdk-slim(openjdk版本“11.0.6”2
我非常接近这项工作,我试图直接将一个 jasper 子报告嵌入到另一个的主报告 xml 中。你会认为这很容易,但我找不到一个关于这样做的例子。每个人似乎都在使用文件或资源或其他任何东西。我有一个直接从
出于某种原因,我的带有日期和页面 x/y 的页脚只打印在最后一页。有谁知道为什么? 我正在使用 JasperReports 3.1.2和 iReport 3.0.0 . 编辑 :只是为了记录:在我从
这应该是一个关于 JasperReports 的简单问题。我正在尝试对整个报告做一个简单的计数器,该计数器应根据条件递增。但是,无论我尝试什么,似乎计数器变量总是在递增,无论变量表达式如何。我的变量的
有没有办法对 JasperReport 的大小设置限制?我们刚刚查看了一个 WebSphere 6.1 Heapdump,有人试图创建一个报告,结果堆中有 1.5GB 的内存。它使我们的 Websph
我希望在我的项目中使用 JasperReports 4.5.0,并且想知道仅生成 PDF 的最小依赖项是什么。我尝试浏览他们的网站和自述文档,但一无所获。我也遇到过这个installation wik
我只想将数据集中的唯一值打印到列表组件中,避免重复值。 怎么做? 附言我正在使用XML作为数据源。 最佳答案 使用X-Path在数据源中选择节点时,请尝试以下类似的操作。 /root/*[not(te
我想要让 JasperReports 子报表中的行交替显示颜色。我的所有行都具有相同的背景颜色,但我希望它交替。这可以吗? 最佳答案 是的,可以set up a style在 JRXML 文件中,如下
我是一名优秀的程序员,十分优秀!