当内容大于框架时,JasperReports的HTML组件就会缩小

时间:2018-12-09 15:17:35

标签: html jasper-reports

我正在使用iReport生成报告。我需要在报告中显示HTML内容。我引用了link(Export html content to pdf using JasperReports)并应用了必要的jar,并且能够使用HTML组件获取报告。

我们的应用程序中有富文本编辑器。它必须显示在报告中。富文本编辑器将为我们提供一个HTML字符串,该字符串使用HTML组件呈现。

问题:在报告输出中,当HTML内容大于框架时,该内容将缩小并显示。溢出时无法拉伸。 注意:尝试了所有比例类型选项,但没有一个导致解决方案。

输出快照:

输出更多数据: Report Output with more data

输出较少的数据: Report Output with less data

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="report3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a68bd555-1d68-49e7-be27-9b152830d349">
    <style name="table">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1">
        <box>
            <pen lineWidth="1.0" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="Table Dataset 1" uuid="6dda9e0f-4cb6-492b-bc53-ad64f8f3c572">
        <parameter name="parameter1" class="java.lang.String"/>
    </subDataset>
    <parameter name="parameter1" class="java.lang.String"/>
    <group name="asd">
        <groupExpression><![CDATA[$V{PAGE_NUMBER}]]></groupExpression>
        <groupHeader>
            <band height="138">
                <componentElement>
                    <reportElement key="table" style="table" stretchType="RelativeToTallestObject" x="0" y="0" width="555" height="136" uuid="8435c53e-4068-4ebb-9604-e95ce7e31fce"/>
                    <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                        <datasetRun subDataset="Table Dataset 1" uuid="6343fcbb-31b2-413a-804e-acea580c7dd2">
                            <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
                        </datasetRun>
                        <jr:column width="436" uuid="0adde13b-d941-4695-a55d-22918541d075">
                            <jr:columnHeader style="table_CH" height="35" rowSpan="1">
                                <textField>
                                    <reportElement x="0" y="0" width="436" height="35" uuid="eafaea0a-b010-4c6e-b21e-da32c1df3859"/>
                                    <textFieldExpression><![CDATA["Column"]]></textFieldExpression>
                                </textField>
                            </jr:columnHeader>
                            <jr:detailCell style="table_TD" height="101" rowSpan="1">
                                <componentElement>
                                    <reportElement style="table" stretchType="RelativeToTallestObject" x="0" y="1" width="436" height="100" isPrintWhenDetailOverflows="true" uuid="2b4df7ba-fbef-44b9-838d-b3e585a7b2f1"/>
                                    <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">
                                        <hc:htmlContentExpression><![CDATA["<p style='table;padding-left: 30px;'>Procedure<br /><span style='text-decoration: underline;'>NOTE:</span> For the basic Aircraft configuration, refer to Ref. INTRO A350-A-00-6X-XX-11ZZZ-018Z-D &ldquo;Introductions&rdquo;.</p>"]]></hc:htmlContentExpression>
                                    </hc:html>
                                </componentElement>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="35" uuid="2141b0e3-64ff-4133-8bd1-ec13e1191b2e">
                            <jr:columnHeader style="table_CH" height="35" rowSpan="1">
                                <textField>
                                    <reportElement x="0" y="0" width="35" height="35" uuid="4f152705-b7fa-4184-a3d5-1124c5fe4e07"/>
                                    <textFieldExpression><![CDATA["Column1"]]></textFieldExpression>
                                </textField>
                            </jr:columnHeader>
                            <jr:detailCell style="table_TD" height="101" rowSpan="1"/>
                        </jr:column>
                        <jr:column width="48" uuid="32e77e5d-73e9-4d4b-b501-57153d212800">
                            <jr:columnHeader style="table_CH" height="35" rowSpan="1">
                                <textField>
                                    <reportElement x="0" y="0" width="46" height="35" uuid="26d09584-674d-442e-81b8-cb8941b6fad7"/>
                                    <textFieldExpression><![CDATA["Column2"]]></textFieldExpression>
                                </textField>
                            </jr:columnHeader>
                            <jr:detailCell style="table_TD" height="101" rowSpan="1"/>
                        </jr:column>
                        <jr:column width="38" uuid="14778a16-6346-437c-ae9c-4e771080012d">
                            <jr:columnHeader style="table_CH" height="35" rowSpan="1">
                                <textField>
                                    <reportElement x="0" y="0" width="38" height="35" uuid="a811171f-614b-4db5-ba7f-e0cc9f570e7c"/>
                                    <textFieldExpression><![CDATA["Column3"]]></textFieldExpression>
                                </textField>
                            </jr:columnHeader>
                            <jr:detailCell style="table_TD" height="101" rowSpan="1"/>
                        </jr:column>
                    </jr:table>
                </componentElement>
            </band>
        </groupHeader>
        <groupFooter>
            <band height="50"/>
        </groupFooter>
    </group>
</jasperReport>

0 个答案:

没有答案