Удалить пробелы между texfield - PullRequest
0 голосов
/ 27 января 2020

В моем отчете есть раздел с некоторым текстовым полем. Большинство из них будут напечатаны при определенных условиях c. Проблема заключается в том, что если элемент не печатается, между полями текста остаются пустые места. Я попытался isBlankWhenNull = "true" и isRemoveLineWhenBlank = "true" и другой вариант растяжения, но я не могу решить эту проблему. Кто-нибудь может мне помочь, пожалуйста?

Вот мой исходный код:

                                                <?xml version="1.0" encoding="UTF-8"?>
                            <!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b  -->
                            <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="Candidato Dynamic" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="4e46738b-8f9f-4bfa-95b8-8ba042598411">
                                <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
                                <property name="com.jaspersoft.studio.data.defaultdataadapter" value="lsp_dev.xml"/>
                                <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="600"/>
                                <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="386"/>
                                <property name="net.sf.jasperreports.components.table.generate.pdf.tags" value="true"/>
                                <property name="com.jaspersoft.studio.unit." value="pixel"/>
                                <parameter name="UID_PERSON" class="java.lang.String"/>
                                <parameter name="PATH_AVATAR" class="java.lang.String"/>
                                <queryString language="SQL">
                                    <![CDATA[select 
                            upper(lsp_v_person.attr_firstname) attr_firstname,
                            upper(lsp_v_person.attr_lastname) attr_lastname ,
                            to_char(lsp_v_person.date_birth,'DD/MM/YYYY') date_birth,
                            INITCAP(lsp_v_person.attr_birthplace) attr_birthplace ,
                            upper(lsp_v_person.attr_fiscalcode) attr_fiscalcode,
                            lsp_v_person.attr_height||' cm.' attr_height,
                            lsp_v_person.attr_weight||' kg.' attr_weight,
                            (select (case when flag_registered = 'Y' then 'SI' else 'NO' end) as immatricolato_luiss from lsp.lsp_v_person where uid_person =$P{UID_PERSON}),
                            lsp_v_address.attr_street,
                            lsp_v_address.attr_postalcode,
                            lsp_v_education.attr_current_school,
                            coalesce(lsp_v_education.attr_mark,'-') attr_mark,
                            to_char(lsp_v_education.date_qualification, 'MM/YYYY') date_qualification,
                            lsp_v_person.attr_freshman attr_matricola_luiss,
                            (select upper(attr_city) from lsp.lsp_v_address where code_type_address = 'REGISTERED-RESIDENCE' and  uid_person = $P{UID_PERSON}) attr_residenza,
                            (select upper(attr_province) from lsp.lsp_v_address where code_type_address = 'REGISTERED-RESIDENCE' and  uid_person = $P{UID_PERSON}) attr_provincia,
                            (select desc_luiss_school from lsp.lsp_l_luiss_school where code_luiss_school in (select code_luiss_school from lsp.lsp_v_education where uid_person = $P{UID_PERSON})) attr_corso_luiss,
                            (select attr_desc_free from lsp.lsp_l_luiss_school where code_luiss_school in (select code_luiss_school from lsp.lsp_v_education where uid_person = $P{UID_PERSON})) attr_descr_master,
                            (select desc_gender from lsp.lsp_l_gender where code_gender in (select code_gender from lsp.lsp_v_person where uid_person = $P{UID_PERSON})) as attr_sesso,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'E-MAIL' and uid_person = $P{UID_PERSON}) as attr_email,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'PHONE' and uid_person = $P{UID_PERSON}) as attr_phone,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'MOBILE-PHONE' and uid_person = $P{UID_PERSON}) as attr_mobile_phone,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'LINKEDIN' and uid_person = $P{UID_PERSON}) as attr_linkedin,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'SKYPE' and uid_person = $P{UID_PERSON}) as attr_skype,
                            (select coalesce(attr_val,'-') from lsp.lsp_v_contact where code_type_contact = 'WEBSITE' and uid_person = $P{UID_PERSON}) as attr_website,
                            (select desc_type_sport from lsp.lsp_l_type_sport where code_type_sport in (select code_type_sport from lsp.lsp_v_sport where uid_person = $P{UID_PERSON})) as attr_sport,
                            (select to_char(date_agonism, 'DD/MM/YYYY') from lsp.lsp_v_sport where uid_person = $P{UID_PERSON}) as attr_date_agonism,
                            (select attr_last_society from lsp.lsp_v_sport where uid_person = $P{UID_PERSON}) as attr_societa_appartenenza,
                            (select (case when flag_luiss_team = 'Y' then 'SI' else 'NO' end) from lsp.lsp_v_sport where uid_person = $P{UID_PERSON}) as attr_luiss_team,
                            (select attr_hours_month_training from lsp.lsp_v_sport where uid_person = $P{UID_PERSON}) as attr_hours_month_training,
                            (select (case when trim(lsp_v_education.attr_current_position) = '001' then 'Attualmente frequento l''ultimo anno della scuola secondaria' 
                                          when trim(lsp_v_education.attr_current_position) = '002' then 'Mi sono diplomato'
                                          when trim(lsp_v_education.attr_current_position) = '003' then 'Attualmente sono iscritto presso l''università'
                                          when trim(lsp_v_education.attr_current_position) = '004' then 'Mi sono laureato o conto di laurearmi'
                                    end)
                                    from lsp.lsp_v_education
                                    where uid_person = $P{UID_PERSON}) as attr_current_position,
                            (select uid_person||'.'||attr_file_ext from lsp.lsp_v_attachment where code_type_attachment = 'AVATAR' and uid_person = $P{UID_PERSON}) attr_avatar
                            from  lsp.lsp_v_person lsp_v_person, lsp.lsp_v_address lsp_v_address, lsp.lsp_v_education lsp_v_education
                            where lsp_v_person.uid_person = lsp_v_address.uid_person and lsp_v_person.uid_person = lsp_v_education.uid_person and lsp_v_person.uid_person = $P{UID_PERSON}]]>
                                </queryString>
                                <field name="attr_firstname" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_firstname"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_lastname" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_lastname"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="date_birth" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="date_birth"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_birthplace" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_birthplace"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_fiscalcode" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_fiscalcode"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_height" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_height"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_weight" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_weight"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="immatricolato_luiss" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="immatricolato_luiss"/>
                                </field>
                                <field name="attr_street" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_street"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_address"/>
                                </field>
                                <field name="attr_postalcode" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_postalcode"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_address"/>
                                </field>
                                <field name="attr_current_school" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_current_school"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_education"/>
                                </field>
                                <field name="attr_mark" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_mark"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_education"/>
                                </field>
                                <field name="date_qualification" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="date_qualification"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_education"/>
                                </field>
                                <field name="attr_matricola_luiss" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_matricola_luiss"/>
                                    <property name="com.jaspersoft.studio.field.tree.path" value="lsp_v_person"/>
                                </field>
                                <field name="attr_residenza" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_residenza"/>
                                </field>
                                <field name="attr_provincia" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_provincia"/>
                                </field>
                                <field name="attr_corso_luiss" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_corso_luiss"/>
                                </field>
                                <field name="attr_descr_master" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_descr_master"/>
                                </field>
                                <field name="attr_sesso" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_sesso"/>
                                </field>
                                <field name="attr_email" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_email"/>
                                </field>
                                <field name="attr_phone" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_phone"/>
                                </field>
                                <field name="attr_mobile_phone" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_mobile_phone"/>
                                </field>
                                <field name="attr_linkedin" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_linkedin"/>
                                </field>
                                <field name="attr_skype" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_skype"/>
                                </field>
                                <field name="attr_website" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_website"/>
                                </field>
                                <field name="attr_sport" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_sport"/>
                                </field>
                                <field name="attr_date_agonism" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_date_agonism"/>
                                </field>
                                <field name="attr_societa_appartenenza" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_societa_appartenenza"/>
                                </field>
                                <field name="attr_luiss_team" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_luiss_team"/>
                                </field>
                                <field name="attr_hours_month_training" class="java.math.BigDecimal">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_hours_month_training"/>
                                </field>
                                <field name="attr_current_position" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_current_position"/>
                                </field>
                                <field name="attr_avatar" class="java.lang.String">
                                    <property name="com.jaspersoft.studio.field.label" value="attr_avatar"/>
                                </field>
                                <group name="Group1" footerPosition="StackAtBottom" keepTogether="true">
                                    <groupExpression><![CDATA[true]]></groupExpression>
                                </group>
                                <detail>
                                    <band height="350" splitType="Stretch">
                                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                                        <frame>
                                            <reportElement positionType="Float" stretchType="ElementGroupBottom" x="10" y="60" width="563" height="199" isRemoveLineWhenBlank="true" uuid="ccae29c1-11fe-443a-bba9-2020f4e0b20d"/>
                                            <staticText>
                                                <reportElement x="0" y="0" width="290" height="27" uuid="88cada2b-2c37-45a2-bfb8-2cf809bef7b1"/>
                                                <textElement textAlignment="Left" verticalAlignment="Middle">
                                                    <font fontName="Titillium Web" size="16" isBold="true" isItalic="false" isUnderline="false"/>
                                                </textElement>
                                                <text><![CDATA[Dati Accademici]]></text>
                                            </staticText>
                                            <line>
                                                <reportElement x="1" y="27" width="562" height="2" forecolor="#D4D4D4" uuid="8578724f-f149-4d49-a194-db377c65f840"/>
                                            </line>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="71" width="560" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="d57c9d80-c194-40c4-b1e6-08d90d124934">
                                                    <printWhenExpression><![CDATA[$F{immatricolato_luiss}.equals("NO") && $F{immatricolato_luiss} != null]]></printWhenExpression>
                                                </reportElement>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA[IF($F{attr_current_position}.equals("'Attualmente sono iscritto presso l'università'"), "<style forecolor=\"black\">Nome dell'Università: </style>"+$F{attr_current_school},"<style forecolor=\"black\">Nome dell'Istituto: </style>"+$F{attr_current_school})]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="115" width="322" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="6b6c53af-10a2-47e4-9cbf-0d2f5561e7a8">
                                                    <printWhenExpression><![CDATA[$F{attr_current_position}.equals("Mi sono diplomato")]]></printWhenExpression>
                                                </reportElement>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA["<style forecolor=\"black\">Votazione in centesimi: </style>"+$F{attr_mark}]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="1" y="92" width="559" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="c32a6859-488c-4471-96fc-e6ecf8d2cd02"/>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA[IF($F{attr_current_position}.equals("Mi sono diplomato"),"<style forecolor=\"black\">Nel: </style>"+$F{date_qualification},"<style forecolor=\"black\">Conto di diplomarmi entro: </style>"+$F{date_qualification})]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="137" width="560" height="21" isRemoveLineWhenBlank="true" printWhenGroupChanges="Group1" forecolor="#138ACF" uuid="a533e031-7eea-47fc-8a66-2f3fde100285">
                                                    <printWhenExpression><![CDATA[$F{immatricolato_luiss}.equals("NO")]]></printWhenExpression>
                                                </reportElement>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="none">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA[IF($F{attr_current_position}.equals("Attualmente sono iscritto presso l'università"),"<style forecolor=\"black\">Chiedo il trasferimento al: </style>"+$F{attr_corso_luiss}, "<style forecolor=\"black\">Vorrei iscrivermi al corso di laurea triennale:  </style>"+$F{attr_corso_luiss} )]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement x="0" y="31" width="312" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="81408006-8bed-49e5-8890-289e2ff89055"/>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA["<style forecolor=\"black\">Immatricolato Luiss: </style>"+$F{immatricolato_luiss}]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="51" width="560" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="4e10eade-6569-4089-a95a-4962eb667982"/>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA[IF($F{immatricolato_luiss}.equals("SI"),"<style forecolor=\"black\">Matricola : </style>"+$F{attr_matricola_luiss},"<style forecolor=\"black\">Posizione Studente: </style>"+$F{attr_current_position})]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="155" width="560" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="e015d00b-f178-45b0-b698-3842a22871a7">
                                                    <printWhenExpression><![CDATA[$F{immatricolato_luiss}.equals("SI")]]></printWhenExpression>
                                                </reportElement>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA["<style forecolor=\"black\">Dipartimento/Scuola : </style>"+$F{attr_corso_luiss}]]></textFieldExpression>
                                            </textField>
                                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                                <reportElement positionType="Float" x="0" y="178" width="560" height="21" isRemoveLineWhenBlank="true" forecolor="#138ACF" uuid="9dc20569-708e-4a15-9ba6-a87c14cfc8cf">
                                                    <printWhenExpression><![CDATA[$F{immatricolato_luiss}.equals("SI") && ($F{attr_corso_luiss} .equals("Master"))]]></printWhenExpression>
                                                </reportElement>
                                                <textElement textAlignment="Left" verticalAlignment="Middle" markup="styled">
                                                    <font fontName="Titillium Web" size="12" isBold="true" isItalic="false"/>
                                                </textElement>
                                                <textFieldExpression><![CDATA["<style forecolor=\"black\">Specificare: </style>"+$F{attr_descr_master}]]></textFieldExpression>
                                            </textField>
                                        </frame>
                                    </band>
                                </detail>
                            </jasperReport>

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...