ireport+jasper simple use summary

In the project, the report needs to be exported. The current logic is that the front end first gives a preview in HTML format to customize the font size of some of the content. 

The background will also change

when drawing the ireport template 

1. The problem of image loading depends on the image passed in from the background.

    a. First add <parameter name="imageURL" class="java.lang.String"/> tag to xml

    b. Add the image tag again

        <image isUsingCache="false" isLazy="true">
<reportElement x="73" y="91" width="198" height="89" uuid="0d57aeba-b807-42be-8dc2-7d138a181cf0"/>
<imageExpression><![CDATA[$P{imageURL}]]></imageExpression>

</image>

       c. Remember to add the imageURL parameter in the java code

               


2. How to solve the problem of font size, because we need to support adjusting the font size in the demand, so when designing the original design, the form of HTML report was first stored in the front end

Let the user adjust the text size by themselves. Here we can change the font edited by the user to HTML format on the front end (the font size can also be passed on the front end)

We can change the textFiled tag to support HTML format 

<textField isStretchWithOverflow="true">
<reportElement x="71" y="20" width="412" height="92" uuid="86143b2e-1bd6-4703-97c8-9d97ba7e165d"/>
<textElement markup="html">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{pathNote}]]></textFieldExpression>
</textField>

 Then it is generated 

For the time being, I only know so much about jasper, and I need to read more


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324495127&siteId=291194637