#1 2024-02-27 12:04:43

dwn
Member
Registered: 2024-02-06

css style in jasperreport

I am mainly viewing a report as HTML and embedding it within another HTML page.
I have a jasper report with conditional formatting. In certain conditions, I can currently set the style with a specific background. Let's say red.
My users want a BLINKING background in certain conditions. In html, it is possible to do this by using javascript on a style.
So basically, I'd like to define a style e.g. BlinkingStyle in the jasperreport.
Then I'd like to be able to override that BlinkingStyle in the html page embedding the jasperreport

How can I do this?
At the moment the styles I define in the jasperreport are just being translated to basic html styling.

Offline

#2 2024-02-27 12:08:21

eduardo
Administrator
Registered: 2016-11-01
Website

Re: css style in jasperreport

Hi dwn,

I'm uncertain if this functionality is achievable with JasperReports, but I suggest consulting the JasperReports documentation for guidance. You can refer to resources such as: https://jasperreports.sourceforge.net/J … uide-3.pdf

Regards,
Eduardo

Offline

#3 2024-02-27 12:26:07

dwn
Member
Registered: 2024-02-06

Re: css style in jasperreport

Eduardo, as an alternative, I also tried to add a gif image which blinks on a column and display it only for certain conditions.
When I run this report in jasper report, the image shows up blinking in the html file.

When I run it in report server, the image appears on the PDF report view (without blinking of course).
But on the html view, the image is not there. The html source file shows: <img src="" style="height: 30px" alt=""/></td>
the source file has been removed

Last edited by dwn (2024-02-28 12:16:05)

Offline

#4 2024-02-28 13:02:22

dwn
Member
Registered: 2024-02-06

Re: css style in jasperreport

@eduardo, do you have an idea?

Offline

#5 2024-02-29 11:51:26

eduardo
Administrator
Registered: 2016-11-01
Website

Re: css style in jasperreport

Hi dwn,

can you pls create a *minimal* Jasper report that demonstrates this issue? It would be the best with some test data, e.g. some static strings, so it is easy to reproduce and all unnecessary data is discarded. Then we can take a look if this is a bug.

Regards,
Eduardo

Offline

#6 2024-03-01 08:44:26

dwn
Member
Registered: 2024-02-06

Re: css style in jasperreport

OK. Created a report without any data. Just a static text and an image with a link to a gif file.   
Jasper report: https://file.io/PFDXp9jv5BHn
Here is a snapshot of the pdf which shows the image:  https://ibb.co/Kjyrzg3
The HTML report is empty for the image.

In this example, I have referenced a gif image which is on https://upload.wikimedia.org/wikipedia/ … arning.gif for you to have access to it.
I have also referenced the same file hosted on my local reportserver to eliminate any cross-site error.

Offline

#7 2024-03-07 14:48:31

eduardo
Administrator
Registered: 2016-11-01
Website

Re: css style in jasperreport

Hi dwn,

"Deleted
The transfer you requested has been deleted."

pls upload the Jasper again.

Regards,
Eduardo

Offline

#8 2024-04-08 08:42:08

alex_lust
Moderator
Registered: 2020-07-03
Website

Re: css style in jasperreport

When a JRImageRenderer instance is serialized, so is the binary image data it contains. However, if the image element must be lazy loaded (see the isLazy attribute), then the engine will not load the binary image data at report-filling time. Rather, it stores inside the renderer only the java.lang.String location of the image. The actual image data is loaded only when needed for rendering at report-export or view time.

isLazy - flag that specifies whether the image should be loaded and processed during report filling or during exporting, in case that the image is not available at fill time. By default this flag is set to false .

isLazy - flag must be set to true for the html export.

This example solves the HTML export problem and shows the blinking gif-image in the HTML file.:

<summary>
    <band  height="250" splitType="Stretch">
        <image scaleImage="Clip" vAlign="Bottom" isLazy="true">
          <reportElement x="0" y="0" width="555" height="250"/>
          <imageExpression class="java.lang.String">"file:///C:/Users/mypc/Desktop/Blinking_warning.gif"</imageExpression>
        </image>
    </band>
</summary>

Offline

Board footer

Powered by FluxBB