如何使用PHP Jasper在XML数据源上使用多个xpath数据集? [英] How to use multiple xpath datasets on XML datasource using PHP Jasper?

查看:48
本文介绍了如何使用PHP Jasper在XML数据源上使用多个xpath数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jasper Studio中设计了一个报告,该报告使用XML作为数据源和两个XPATH数据集.我能够生成报告,并且从第一个数据集(/data/invoice)填充了数据,但是找不到第二个数据集(/data/invoice_items/row)并返回null.

I have designed a report in Jasper Studio that use XML as datasource and two XPATH datasets. I am able to generate the report and the data is filled from the first dataset (/data/invoice), but the second dataset (/data/invoice_items/row) is not found and returns null.

如何为'xml_xpath'=> '/data/invoice_items/row'

How can I add a second xpath to the php script for 'xml_xpath' => '/data/invoice_items/row'

这是我的XML数据:

<?xml version="1.0" encoding="utf-8"?>
<data>
    <invoice>
        <ID_Invoice>54654</ID_Invoice>
        <Invoice_Code>FCS</Invoice_Code>
        <Invoice_No>1</Invoice_No>
        <Invoice_Date>09/08/2019</Invoice_Date>
        <Seller_Name>Seller</Seller_Name>
        <Seller_VAT_Code>123123</Seller_VAT_Code>
        <Seller_Adress>New York</Seller_Adress>
        <Seller_Email/>
        <Partner_Name>John</Partner_Name>
        <Partner_VAT_Code>123456789</Partner_VAT_Code>
        <Partner_Adress>Atlanta</Partner_Adress>
        <Partner_Email/>
    </invoice>
    <invoice_items>
        <row>
            <ID_Invoice_Row>29433</ID_Invoice_Row>
            <Denumire>Product 1</Denumire>
            <Valoare>555.0000</Valoare>
            <VAT>0.0000</VAT>
            <TOTAL>555.0000</TOTAL>
        </row>
        <row>
            <ID_Invoice_Row>42345</ID_Invoice_Row>
            <Denumire>Product 2</Denumire>
            <Valoare>555.0000</Valoare>
            <VAT>0.0000</VAT>
            <TOTAL>555.0000</TOTAL>
        </row>
        <row>
            <ID_Invoice_Row>11234</ID_Invoice_Row>
            <Denumire>Product 3</Denumire>
            <Valoare>555.0000</Valoare>
            <VAT>0.0000</VAT>
            <TOTAL>555.0000</TOTAL>
        </row>
    </invoice_items>
</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="Factura" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="153c2ff6-b65d-49fa-80de-5c1a093eafcc">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="FC_XML"/>
    <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="Factura_pozitii" uuid="1ee50e5a-b071-4886-8407-2ac843fb9ad1">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="FC_XML"/>
        <queryString language="XPath">
            <![CDATA[/data/invoice_items/row]]>
        </queryString>
        <field name="ID_Invoice_Row" class="java.lang.Integer">
            <property name="net.sf.jasperreports.xpath.field.expression" value="ID_Invoice_Row"/>
            <fieldDescription><![CDATA[ID_Invoice_Row]]></fieldDescription>
        </field>
        <field name="Denumire" class="java.lang.String">
            <property name="net.sf.jasperreports.xpath.field.expression" value="Denumire"/>
            <fieldDescription><![CDATA[Denumire]]></fieldDescription>
        </field>
        <field name="Valoare" class="java.lang.Float">
            <property name="net.sf.jasperreports.xpath.field.expression" value="Valoare"/>
            <fieldDescription><![CDATA[Valoare]]></fieldDescription>
        </field>
        <field name="VAT" class="java.lang.Float">
            <property name="net.sf.jasperreports.xpath.field.expression" value="VAT"/>
            <fieldDescription><![CDATA[VAT]]></fieldDescription>
        </field>
        <field name="TOTAL" class="java.lang.Float">
            <property name="net.sf.jasperreports.xpath.field.expression" value="TOTAL"/>
            <fieldDescription><![CDATA[TOTAL]]></fieldDescription>
        </field>
    </subDataset>
    <queryString language="XPath">
        <![CDATA[/data/invoice]]>
    </queryString>
    <field name="Seller_Name" class="java.lang.String">
        <property name="net.sf.jasperreports.xpath.field.expression" value="Seller_Name"/>
        <fieldDescription><![CDATA[Seller_Name]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <columnHeader>
        <band height="34" splitType="Stretch">
            <textField>
                <reportElement x="90" y="0" width="175" height="15" uuid="e9843cbc-f80d-4d43-ba3e-12abb7c1ed11"/>
                <textFieldExpression><![CDATA[$F{Seller_Name}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="0" y="0" width="80" height="15" uuid="449ed594-81b1-420c-b361-55709bd951c7"/>
                <text><![CDATA[Seller name:]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="92" splitType="Stretch">
            <componentElement>
                <reportElement x="0" y="0" width="555" height="60" uuid="93a83571-11ee-4173-9726-846f15cbdfec"/>
                <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" whenNoDataType="Blank">
                    <datasetRun subDataset="Factura_pozitii" uuid="8a5ec067-61b0-4580-8aee-4fe353996db3">
                        <datasetParameter name="XML_DATA_DOCUMENT">
                            <datasetParameterExpression><![CDATA[$P{XML_DATA_DOCUMENT}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_INPUT_STREAM">
                            <datasetParameterExpression><![CDATA[$P{XML_INPUT_STREAM}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_FILE">
                            <datasetParameterExpression><![CDATA[$P{XML_FILE}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="net.sf.jasperreports.xml.source">
                            <datasetParameterExpression><![CDATA[$P{net.sf.jasperreports.xml.source}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_DATE_PATTERN">
                            <datasetParameterExpression><![CDATA[$P{XML_DATE_PATTERN}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_NUMBER_PATTERN">
                            <datasetParameterExpression><![CDATA[$P{XML_NUMBER_PATTERN}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_LOCALE">
                            <datasetParameterExpression><![CDATA[$P{XML_LOCALE}]]></datasetParameterExpression>
                        </datasetParameter>
                        <datasetParameter name="XML_TIME_ZONE">
                            <datasetParameterExpression><![CDATA[$P{XML_TIME_ZONE}]]></datasetParameterExpression>
                        </datasetParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="40" uuid="d360ed7c-1960-426e-8541-07a125682d7e">
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField>
                                <reportElement x="0" y="0" width="40" height="15" uuid="cdea816f-81e3-4b32-bec6-7791d9862c37"/>
                                <box>
                                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="400" uuid="042fc8f1-a37e-412f-a4e8-f6f747d3054c">
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                            <box>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="400" height="30" uuid="015596ef-4660-4c7f-9b6d-96b6ddf3858d"/>
                                <text><![CDATA[Denumire]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField isStretchWithOverflow="true">
                                <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="400" height="15" isPrintWhenDetailOverflows="true" uuid="983e6d52-1734-4ace-b791-ec8cfc03cf7c"/>
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textFieldExpression><![CDATA[$F{Denumire}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="50" uuid="69c6f7bc-1e99-4ced-afcd-adfc2d8930a9">
                        <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                            <box>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <staticText>
                                <reportElement x="0" y="0" width="50" height="30" uuid="0aa9d86a-dda0-469d-9923-b3d1e996b583"/>
                                <text><![CDATA[valoare]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell style="Table_TD" height="15">
                            <box>
                                <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                            </box>
                            <textField pattern="#,##0.###">
                                <reportElement x="0" y="0" width="50" height="15" uuid="11006503-d218-4a64-b8d4-240f611c4727"/>
                                <box>
                                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textFieldExpression><![CDATA[$F{Valoare}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>
</jasperReport>

php代码:

use PHPJasper\PHPJasper;

$input = '/your_input_path/your_report.jasper';
$output = '/your_output_path';
$data_file = __DIR__ . '/your_data_files_path/your_xml_file.xml';
$options = [
    'format' => ['pdf'],
    'params' => [],
    'locale' => 'en',
    'db_connection' => [
        'driver' => 'xml',
        'data_file' => $data_file,
        'xml_xpath' => '/data/invoice'
    ]
];

$jasper = new PHPJasper();

$jasper->process(
    $input,
    $output,
    $options
)->execute();

如果我在终点站跑,它会说:

If I run in terminat it says:

WARN JRXpathQueryExecuter:130-未提供XML源

WARN JRXpathQueryExecuter:130 - No XML source was provided

我认为这是第二个数据集,因为第一个可以.

I think it is for the second dataset, because the first is OK.

推荐答案

当前在您的jrxml中,您需要两个数据源(1个用于主数据源,1个用于表数据),实际上,此报告将在JasperSoft Studio中工作,例如定义一个正确的数据源. 数据适配器.

Currently in your jrxml you are expecting two datasources (1 for main, 1 for table), in fact this report will work for example in JasperSoft Studio defining a correct data adapter.

但是,让我们仅使用您的php代码中定义的1个数据源来找到解决方案.

However lets find a solution using only 1 datasource as defined in your php code.

在jasper报告中,您可以使用

In jasper reports you can create a new datasource from an xml datasource by using subDataSource in this case on main datasource.

使用当前节点(记录)作为文档的根来创建子数据源.附加的XPath表达式指定应用于此新文档的选择条件,并为数据源生成节点(记录).

Creates a sub data source using the current node (record) as the root of the document. An additional XPath expression specifies the select criteria applied to this new document and that produces the nodes (records) for the data source.

当前节点,是粗体的,因为这是我们的第一个问题,您当前的主要XPath查询/data/invoice太深,因为我们想在data/invoice_items

current node, is bold because this is our first issue, your current main XPath query /data/invoice is too deep since we want to create a datasource on data/invoice_items

  1. 在php和jrxml中的主要XPath查询中仅选择data.

<queryString language="XPath">
    <![CDATA[/data]]>
</queryString>

  • 相应地调整您的主要字段,您需要向下导航至invoice,请参见fieldDescription.

  • Adjust your main fields accordingly, you need to navigate down to invoice see fieldDescription.

    <field name="Seller_Name" class="java.lang.String">
        <property name="net.sf.jasperreports.xpath.field.expression" value="Seller_Name"/>
        <fieldDescription><![CDATA[invoice/Seller_Name]]></fieldDescription>
    </field>
    

  • 为表创建subDataSource

    <datasetRun subDataset="Factura_pozitii" uuid="8a5ec067-61b0-4580-8aee-4fe353996db3">
         .. params ..
         <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/data/invoice_items/row")]]></dataSourceExpression>
    </datasetRun>
    

  • 完成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="Factura" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="153c2ff6-b65d-49fa-80de-5c1a093eafcc">
        <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
            <box>
                <pen lineWidth="0.5" lineColor="#000000"/>
                <topPen lineWidth="0.5" lineColor="#000000"/>
                <leftPen lineWidth="0.5" lineColor="#000000"/>
                <bottomPen lineWidth="0.5" lineColor="#000000"/>
                <rightPen lineWidth="0.5" lineColor="#000000"/>
            </box>
        </style>
        <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
            <box>
                <pen lineWidth="0.5" lineColor="#000000"/>
                <topPen lineWidth="0.5" lineColor="#000000"/>
                <leftPen lineWidth="0.5" lineColor="#000000"/>
                <bottomPen lineWidth="0.5" lineColor="#000000"/>
                <rightPen lineWidth="0.5" lineColor="#000000"/>
            </box>
        </style>
        <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
            <box>
                <pen lineWidth="0.5" lineColor="#000000"/>
                <topPen lineWidth="0.5" lineColor="#000000"/>
                <leftPen lineWidth="0.5" lineColor="#000000"/>
                <bottomPen lineWidth="0.5" lineColor="#000000"/>
                <rightPen lineWidth="0.5" lineColor="#000000"/>
            </box>
        </style>
        <subDataset name="Factura_pozitii" uuid="1ee50e5a-b071-4886-8407-2ac843fb9ad1">
            <queryString language="XPath">
                <![CDATA[/data/invoice_items/row]]>
            </queryString>
            <field name="ID_Invoice_Row" class="java.lang.Integer">
                <property name="net.sf.jasperreports.xpath.field.expression" value="ID_Invoice_Row"/>
                <fieldDescription><![CDATA[ID_Invoice_Row]]></fieldDescription>
            </field>
            <field name="Denumire" class="java.lang.String">
                <property name="net.sf.jasperreports.xpath.field.expression" value="Denumire"/>
                <fieldDescription><![CDATA[Denumire]]></fieldDescription>
            </field>
            <field name="Valoare" class="java.lang.Float">
                <property name="net.sf.jasperreports.xpath.field.expression" value="Valoare"/>
                <fieldDescription><![CDATA[Valoare]]></fieldDescription>
            </field>
            <field name="VAT" class="java.lang.Float">
                <property name="net.sf.jasperreports.xpath.field.expression" value="VAT"/>
                <fieldDescription><![CDATA[VAT]]></fieldDescription>
            </field>
            <field name="TOTAL" class="java.lang.Float">
                <property name="net.sf.jasperreports.xpath.field.expression" value="TOTAL"/>
                <fieldDescription><![CDATA[TOTAL]]></fieldDescription>
            </field>
        </subDataset>
        <queryString language="XPath">
            <![CDATA[/data]]>
        </queryString>
        <field name="Seller_Name" class="java.lang.String">
            <property name="net.sf.jasperreports.xpath.field.expression" value="Seller_Name"/>
            <fieldDescription><![CDATA[invoice/Seller_Name]]></fieldDescription>
        </field>
        <columnHeader>
            <band height="34" splitType="Stretch">
                <textField>
                    <reportElement x="90" y="0" width="175" height="15" uuid="e9843cbc-f80d-4d43-ba3e-12abb7c1ed11"/>
                    <textFieldExpression><![CDATA[$F{Seller_Name}]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement x="0" y="0" width="80" height="15" uuid="449ed594-81b1-420c-b361-55709bd951c7"/>
                    <text><![CDATA[Seller name:]]></text>
                </staticText>
            </band>
        </columnHeader>
        <detail>
            <band height="92" splitType="Stretch">
                <componentElement>
                    <reportElement x="0" y="0" width="555" height="60" uuid="93a83571-11ee-4173-9726-846f15cbdfec"/>
                    <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" whenNoDataType="Blank">
                        <datasetRun subDataset="Factura_pozitii" uuid="8a5ec067-61b0-4580-8aee-4fe353996db3">
                            <datasetParameter name="XML_DATE_PATTERN">
                                <datasetParameterExpression><![CDATA[$P{XML_DATE_PATTERN}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="XML_NUMBER_PATTERN">
                                <datasetParameterExpression><![CDATA[$P{XML_NUMBER_PATTERN}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="XML_LOCALE">
                                <datasetParameterExpression><![CDATA[$P{XML_LOCALE}]]></datasetParameterExpression>
                            </datasetParameter>
                            <datasetParameter name="XML_TIME_ZONE">
                                <datasetParameterExpression><![CDATA[$P{XML_TIME_ZONE}]]></datasetParameterExpression>
                            </datasetParameter>
                            <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/data/invoice_items/row")]]></dataSourceExpression>
                        </datasetRun>
                        <jr:column width="40" uuid="d360ed7c-1960-426e-8541-07a125682d7e">
                            <jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
                            <jr:detailCell style="Table_TD" height="15">
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textField>
                                    <reportElement x="0" y="0" width="40" height="15" uuid="cdea816f-81e3-4b32-bec6-7791d9862c37"/>
                                    <box>
                                        <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    </box>
                                    <textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="400" uuid="042fc8f1-a37e-412f-a4e8-f6f747d3054c">
                            <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="400" height="30" uuid="015596ef-4660-4c7f-9b6d-96b6ddf3858d"/>
                                    <text><![CDATA[Denumire]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="15">
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textField isStretchWithOverflow="true">
                                    <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="400" height="15" isPrintWhenDetailOverflows="true" uuid="983e6d52-1734-4ace-b791-ec8cfc03cf7c"/>
                                    <box>
                                        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    </box>
                                    <textFieldExpression><![CDATA[$F{Denumire}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="50" uuid="69c6f7bc-1e99-4ced-afcd-adfc2d8930a9">
                            <jr:columnHeader style="Table_CH" height="30" rowSpan="1">
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <staticText>
                                    <reportElement x="0" y="0" width="50" height="30" uuid="0aa9d86a-dda0-469d-9923-b3d1e996b583"/>
                                    <text><![CDATA[valoare]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="15">
                                <box>
                                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textField pattern="#,##0.###">
                                    <reportElement x="0" y="0" width="50" height="15" uuid="11006503-d218-4a64-b8d4-240f611c4727"/>
                                    <box>
                                        <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                    </box>
                                    <textFieldExpression><![CDATA[$F{Valoare}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                    </jr:table>
                </componentElement>
            </band>
        </detail>
    </jasperReport>
    

    这篇关于如何使用PHP Jasper在XML数据源上使用多个xpath数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆