如何从jasper报告设计师中的参数设置背景颜色

发布于 2025-01-25 04:17:29 字数 347 浏览 4 评论 0原文

我正在使用Jasper报告设计报告。我有一个报告,那里有静态文本。我想通过参数值设置其背景颜色。在XML中,它为这样的文本生成:

< reportElement模式=“ opaque” x =“ 434” y =“ 0” width =“ 121” height =“ 12” backcolor =“#a6a6a6” uuid = uuid = uuid = “ E088BD9F-A0AC-4F34-9375-DF765C829EC2”/>

现在,我需要从数据库中的参数设置后色。在这里,例如#A6A6A6

接下来我可以尝试什么?我已经研究了它,但是没有运气。

I am using Jasper Report for designing report. I have a report where there is a static text. I want to set the background color of it by parameter value. In the XML it generates for the text like this:

<reportElement mode="Opaque" x="434" y="0" width="121" height="12" backcolor="#A6A6A6" uuid="e088bd9f-a0ac-4f34-9375-df765c829ec2"/>.

Now I need to set the backcolor from a parameter which will come from database. for here like #A6A6A6.

What can I try next? I have researched it, but no luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最舍不得你 2025-02-01 04:17:29

您可以使用

在您的情况下,您需要

<textField>
  <reportElement ...>
    <propertyExpression name="net.sf.jasperreports.style.backcolor">$P{someColor}</propertyExpression>
  </reportElement>
  ...

You can do that with net.sf.jasperreports.style.* element level properties (for which you can have expressions as values).

In your case you would need

<textField>
  <reportElement ...>
    <propertyExpression name="net.sf.jasperreports.style.backcolor">$P{someColor}</propertyExpression>
  </reportElement>
  ...
睫毛溺水了 2025-02-01 04:17:29

“在此处输入图像说明”

单击“透明”

enter image description here

click the "transparent"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文