- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Jasper 报告 5.2、iReport 5.2 并以 RTF 和 PDF 格式导出报告。
在我的报告中,我想添加一些文本字段及其水平对齐的(静态文本)标签,例如
Name: $F{name}
Age: $F{age}
Date of Birth: $F{dateOfBirth}
最佳答案
它可以在容器的帮助下轻松完成 - 框架元素。
您应该将位置类型的框架设置为 float 并将staticText(标签)和textField都放在他们身上。
对于 textField,我将 Position Type 设置为 float 溢出的拉伸(stretch)为 真实 .
sample
jrxml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="textfields_allign" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d855bf18-5e9b-4060-8caa-3fdd08abce3b">
<parameter name="name" class="java.lang.String"/>
<parameter name="id" class="java.lang.String"/>
<parameter name="date" class="java.lang.String"/>
<title>
<band height="69" splitType="Stretch">
<frame>
<reportElement uuid="314bfd5b-7b0a-42f4-aca3-e61f0283f126" positionType="Float" x="213" y="1" width="243" height="20"/>
<staticText>
<reportElement uuid="e07201bb-a677-4dc9-a332-f94e6eca2722" positionType="Float" x="0" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<text><![CDATA[Name]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement uuid="66c93a44-9015-4ae9-bf05-b68b2420f3ef" positionType="Float" x="121" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression><![CDATA[$P{name}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement uuid="8311a483-955e-4280-a9ac-513d7d34495b" positionType="Float" x="213" y="21" width="243" height="20"/>
<staticText>
<reportElement uuid="da404b4e-7908-40ae-8e1b-38e19d9ddc7f" positionType="Float" x="0" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<text><![CDATA[ID]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement uuid="e0e312e8-cd2f-48af-8ae8-df95c6195488" positionType="Float" x="121" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression><![CDATA[$P{id}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement uuid="8ff2baf9-b0ec-4c8a-b54a-9edd08b200cc" positionType="Float" x="213" y="41" width="243" height="20"/>
<staticText>
<reportElement uuid="b8d97db0-250a-43c8-a2f3-2fa3668c5d15" positionType="Float" x="0" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<text><![CDATA[Date]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement uuid="4daa4d17-28be-4ac8-8e1e-2efbeec5f690" positionType="Float" x="121" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
</jasperReport>
关于jasper-reports - Jasper Reports - 水平对齐动态文本字段及其标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18599795/
我有一个在旧版 iReport 3.0 中构建的 JRXML 报告,现在我想将其更新到较新的 iReport 4.7。 这样做的步骤是什么,请解释一下? 最佳答案 您可以使用位于 jasperserv
我的问题是,即使该行是空白的,它仍然占据了 band 高度的空间,因此在下一个 band 之前有比平时更大的间隙。 我的 jasper 文件中的乐队看起来像这样:
我在使用 Eclipse JasperReports Studio 时遇到了一个我无法解决的问题。我有一个非常基本的报告,其中包含返回大约 30 行的详细信息字段。我有一个要合并到主报告中的子报告,但
我有一个包含许多列但只有几行的交叉表。当我生成报告时,交叉表会重用一页中行下方的空白空间,并为相同的行呈现下一列。这样,几页被垂直压缩在一页上: 我想要第 天的列20 到天 27 (交叉表的第二部分)
我们正在使用 jaspersoft studio 创建报告,但我被困在查询部分。 从逻辑上讲,我想要的查询类型是: select * from mytable where
我想在 ireport 中创建多个组,并且数据应该以分组方式显示。例如: 首先应该完全打印 Group1 数据,然后, 第一组: 模块数据 在此之后我想完全打印 Group2 数据 组2: 类别数据
我有一个 Jasper 报告,它有一个详细信息部分,在详细信息部分内有一个来自数据库的打印字段。因此,如果我的查询返回 100 行,我会得到 100 行,这会生成一个大约 10 页长的报告,因为 10
我正在使用 Jasper 报告。我有一个页眉、详细信息和摘要带。页眉在所有页面上重复,但有时只有摘要部分移到最后一页,因为详细信息在此之前的页面中结束。标题不打印在最后一页,即摘要页。 有人知道为什么
这个问题在这里已经有了答案: How to pass ArrayList to JasperReports? (3 个回答) 上个月关闭。 如何创建将在详细信息部分迭代 arraylist 的报告,该
我有一个包含两个框架的 columnHeader 带。 如果参数为 TRUE,则第一帧必须可见,如果参数为 FALSE,则第二帧必须可见。 所以我只想显示一帧。 我按顺序放置了两帧。可见性还可以,但是
我在 jasper 报告中有一个表格,我需要该表格中某些单元格的内容垂直对齐。 我正在尝试使用 iReport 编辑报告。 在 iReport 中,我可以进入单元格的属性并看到垂直对齐设置为“中间”。
我正在尝试生成包含表格的报告。这些是 jrxml 的重要部分:
我想为文本字段绘制一个虚线底部边框,以多行显示其内容。 例如: Address: 104th Street, - - - - - - - - - - -- - - - - - - -
我在 Maven 中使用 Jasper Reports 5.2.0 和 Spring MVC。 我已经使用 JasperViewer 完成了报告,但突然出现了无法解决的错误: net.sf.jaspe
我想将图像嵌入到我的JasperReports jrxml文件中。我有这个目录结构。 Tomcat Root webapps reports -->images --> compa
我有三个不同的查询,并希望根据 jasper 报告中获取的值运行它们。查询是在 Jrxml 文件本身中编写的。如何根据不同的动态值运行不同的查询。 喜欢(这只是一个 sudo 代码) If($(a)
以下是一些演示问题的屏幕截图:首先,这是没有列表元素的设计: 这是该报告的结果(注意有两页): 现在如果我添加列表元素,设计如下: 这是摘要带的 jrxml:
我们的一份报告经常运行,其中包含大约 14,000 名司机。 参数的架构(在父报表中)如下所示: 选择(在子报表中)的 where 子句如下所示: and $X{IN, cast(e.l
背景:Jaspersoft studio 6. 有这个交叉表: 交叉表的数据集: select 'prod1' as prod, 'mon1' as month, 1 as val u
我想问一下。如何在 中的段落后添加中断一个文本字段 . 例如, 报告是为传达信息的特定目的而制作的文本作品(通常是写作、演讲、电视或电影)。 像这样:- "A report is a textual
我是一名优秀的程序员,十分优秀!