Chaix Posted January 22, 2019 Share Posted January 22, 2019 Hi, I'm new in this community and it's my first time with jasper.I need to create a table with the following header, but with a variable number of rows:BarcodeNumero SpedizioneMittenteDestinatarioQuantitàPesoVolume I created a dataset that contains a field for each column in the table.This is my code:<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final utlizzo versione della libreria JasperReports6.6.0 --><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="Bellesia Order" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="69acd11c-575a-46a9-ba78-ff2cd7319b6d"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#66CCCC"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <topPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="GroupData" uuid="516b1595-bdff-4c8e-ba02-497319eccace"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/> <queryString> <![CDATA[]]> </queryString> <field name="Codice a barre" class="java.lang.String"/> <field name="Numero spedizione" class="java.lang.String"/> <field name="Mittente" class="java.lang.String"/> <field name="Destinatario" class="java.lang.String"/> <field name="Nr. colli" class="java.lang.String"/> <field name="Peso" class="java.lang.String"/> <field name="Volume" class="java.lang.String"/> </subDataset> <queryString> <![CDATA[]]> </queryString> <background> <band/> </background> <title> <band height="72"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/> <image> <reportElement x="0" y="0" width="102" height="72" uuid="370d67ae-08c5-419e-b3e7-c160f17d5bd4"/> <imageExpression><![CDATA["C:/Users/LACTeam/Downloads/logo bellesia trasporti spedizioni formato vettoriale.png"]]></imageExpression> </image> </band> </title> <columnHeader> <band height="111"> <staticText> <reportElement x="0" y="10" width="50" height="20" uuid="5af49920-d5fd-4012-a8e8-d69707dc9649"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Giorno:]]></text> </staticText> <line> <reportElement x="60" y="30" width="90" height="1" uuid="c4ed4a34-c6b3-4411-9c82-c90bc34711dc"/> </line> <staticText> <reportElement x="180" y="10" width="50" height="20" uuid="2ded959b-84fc-4fa4-a888-50ced11acc82"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Mezzo:]]></text> </staticText> <line> <reportElement x="240" y="30" width="90" height="1" uuid="67205656-fe57-45b7-853d-c4a3336aae2d"/> </line> <staticText> <reportElement x="360" y="10" width="60" height="20" uuid="4fdfda98-4394-411e-a56f-556b1f9e7492"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Autista:]]></text> </staticText> <line> <reportElement x="420" y="31" width="135" height="1" uuid="ca45a6b7-8500-4626-8a39-8d6d5e7d9fb5"/> </line> <staticText> <reportElement x="0" y="60" width="80" height="20" uuid="93526dfa-3685-4f07-8a5f-7f38030594b7"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Nr. servizi:]]></text> </staticText> <line> <reportElement x="80" y="80" width="40" height="1" uuid="d36f5c72-07d9-47b1-9982-853fc2a13631"/> </line> <line> <reportElement x="-20" y="110" width="595" height="1" forecolor="#666666" uuid="5f59a2c2-41cd-41ef-8cff-c68e784fdc94"/> </line> <staticText> <reportElement x="150" y="60" width="60" height="20" uuid="86ad5965-f286-4f6e-a9fe-4c7b07f4f5aa"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Tot. km:]]></text> </staticText> <line> <reportElement x="210" y="80" width="60" height="1" uuid="388dc546-c0be-4217-889a-b3ab4af82699"/> </line> <staticText> <reportElement x="300" y="60" width="40" height="20" uuid="3836fdfa-dc55-44a9-b9b6-175492a6ef20"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Peso:]]></text> </staticText> <line> <reportElement x="350" y="80" width="60" height="1" uuid="b455d702-2fce-4cd9-af9e-c814ce1ff316"/> </line> <staticText> <reportElement x="440" y="60" width="40" height="20" uuid="fb3de259-148f-4556-b09d-40bd023a891d"/> <textElement> <font size="15"/> </textElement> <text><![CDATA[Vol.:]]></text> </staticText> <line> <reportElement x="480" y="80" width="75" height="1" uuid="6fcebf79-1fa7-4482-aa4c-aedaa93c5c69"/> </line> </band> </columnHeader> <detail> <band height="674"> <line> <reportElement positionType="FixRelativeToBottom" x="0" y="0" width="555" height="1" uuid="069a0f5a-8986-4a9f-aab3-69941398cfc2"/> </line> <componentElement> <reportElement x="177" y="86" width="200" height="200" uuid="bbc62aba-0602-4efb-a061-320f9dd93944"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/> <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement> <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="GroupData" uuid="a6c22100-db9c-4d7a-be9f-f124a19a0924"/> <jr:column width="28" uuid="6af9bd55-9ce9-4823-85b5-5cb895899272"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="c071c7b8-cf69-4053-9872-f7974343d2ef"/> <text><![CDATA[Codice a barre]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="74446c21-1420-44c1-9eaf-a576e78e770d"/> <textFieldExpression><![CDATA[$F{Codice a barre}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="34e59bb6-1e7b-4504-a2d3-d15f9476a5fe"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="6f7dc38b-f769-416b-aac8-ad5e5caecfb0"/> <text><![CDATA[Numero spedizione]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="dd93752a-2af3-4b77-b6d1-cd8f457efc77"/> <textFieldExpression><![CDATA[$F{Numero spedizione}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="0ef35aa5-dd5d-46b9-ab22-2266d1849472"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="fdfe7e69-078c-4126-9611-87ee79c89900"/> <text><![CDATA[Mittente]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="bd642ce2-e127-4b9c-bab4-75bb45e1901f"/> <textFieldExpression><![CDATA[$F{Mittente}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="2b0d6f82-c683-42c1-b211-2127b7b54edf"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="abfb8729-99b3-4108-b518-8d731fca82e9"/> <text><![CDATA[Destinatario]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="1c47b9d9-2cf8-4e5d-9d8b-5a8099616123"/> <textFieldExpression><![CDATA[$F{Destinatario}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="4a6a89a4-1f55-478b-80db-756fd45ab4fb"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="98ad042c-0f20-42d9-b4dc-b70c2d0200b7"/> <text><![CDATA[Nr. colli]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="76717ebe-ba39-4e19-8358-cfd0a3caa11a"/> <textFieldExpression><![CDATA[$F{Nr. colli}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="9166d519-80c7-4105-8fa5-f088e87f8a0f"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="5475ba7d-749e-4adc-8f98-48bc28398cda"/> <text><![CDATA[Peso]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="e70c3b27-fa5b-4125-8a96-e1b9a9d38cda"/> <textFieldExpression><![CDATA[$F{Peso}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="28" uuid="ccb95842-8862-4e9e-8fea-f9a618a596eb"> <jr:columnHeader style="Table_CH" height="30"> <staticText> <reportElement x="0" y="0" width="28" height="30" uuid="17e1ccf5-5ffd-473e-9ebe-d8ecc5e4220a"/> <text><![CDATA[Volume]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField> <reportElement x="0" y="0" width="28" height="30" uuid="f6a0eeb1-52ee-41fa-88c5-f73b052a3ed5"/> <textFieldExpression><![CDATA[$F{Volume}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail> <columnFooter> <band/> </columnFooter> <pageFooter> <band height="17"> <textField> <reportElement mode="Opaque" x="0" y="4" width="515" height="13" backcolor="#E6E6E6" uuid="5086d2bc-f20b-4ac9-9c7b-0877cf48a6b7"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement mode="Opaque" x="515" y="4" width="40" height="13" backcolor="#E6E6E6" uuid="41d10594-7903-4b64-a202-e2dabf8439e7"/> <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField pattern="EEEEE dd MMMMM yyyy"> <reportElement x="0" y="4" width="100" height="13" uuid="247268ec-11bd-4308-953c-63d2146bc80e"/> <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> </band> </pageFooter> <summary> <band/> </summary></jasperReport>But I don't know how insert data from an excel file.Please, help me.Thanks,Davide Link to comment Share on other sites More sharing options...
hozawa Posted February 3, 2019 Share Posted February 3, 2019 Inserting excel data into table component is not supported. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now