Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:24:59+00:00 2026-06-04T11:24:59+00:00

<style name=blueStyle > <conditionalStyle> <conditionExpression><![CDATA[($P{INDIRIZZO}).length()>30 ? Boolean.TRUE : Boolean.FALSE]]></conditionExpression> <style style=blueStyle fontSize=3/> </conditionalStyle> </style>

  • 0
<style name="blueStyle" >
    <conditionalStyle>
        <conditionExpression><![CDATA[($P{INDIRIZZO}).length()>30 ?  Boolean.TRUE : Boolean.FALSE]]></conditionExpression>
        <style  style="blueStyle"  fontSize="3"/>
    </conditionalStyle>
</style>
<parameter name="INDIRIZZO" class="java.lang.String"/>

[...]

<textField>
    <reportElement x="178" y="94" width="157" height="17"/>
    <textElement>
        <font fontName="Arial" size="9"/>
    </textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$P{INDIRIZZO}]]></textFieldExpression>
</textField>

I want to downsize the font when INDIRIZZO length is > 30…

But this didn’t work….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:25:00+00:00Added an answer on June 4, 2026 at 11:25 am

    You forgot to apply your custom style to the textField.

    The correct snippet will be:

        <textField>
            <reportElement style="blueStyle" x="178" y="94" width="157" height="17"/>
            <textElement>
                <font fontName="Arial" size="9"/>
            </textElement>
            <textFieldExpression class="java.lang.String"><![CDATA[$P{INDIRIZZO}]]></textFieldExpression>
        </textField>
    

    My working sample:

    <?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="conditional_styl" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <style name="style1" forecolor="#66FF66" backcolor="#009966">
            <conditionalStyle>
                <conditionExpression><![CDATA[$P{parameter1}.length() < 2]]></conditionExpression>
                <style forecolor="#FFCC00"/>
            </conditionalStyle>
        </style>
        <parameter name="parameter1" class="java.lang.String"/>
        <queryString>
            <![CDATA[SELECT DOCUMENTID FROM POSITIONS]]>
        </queryString>
        <field name="DOCUMENTID" class="java.lang.Integer"/>
        <detail>
            <band height="20" splitType="Stretch">
                <textField>
                    <reportElement style="style1" x="0" y="0" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{DOCUMENTID}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
    </jasperReport>
    

    Another working sample with fontSize modifying:

    <?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="conditional_styl" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <style name="style1" fontSize="6">
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 2 == 0]]></conditionExpression>
                <style fontSize="8"/>
            </conditionalStyle>
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 3 == 0]]></conditionExpression>
                <style fontSize="10"/>
            </conditionalStyle>
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 5 ==0]]></conditionExpression>
                <style fontSize="12"/>
            </conditionalStyle>
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 7 ==0]]></conditionExpression>
                <style fontSize="14"/>
            </conditionalStyle>
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 11 ==0]]></conditionExpression>
                <style fontSize="16"/>
            </conditionalStyle>
            <conditionalStyle>
                <conditionExpression><![CDATA[$F{DOCUMENTID} % 13 ==0]]></conditionExpression>
                <style fontSize="18"/>
            </conditionalStyle>
        </style>
        <queryString>
            <![CDATA[SELECT distinct DOCUMENTID FROM POSITIONS]]>
        </queryString>
        <field name="DOCUMENTID" class="java.lang.Integer"/>
        <detail>
            <band height="34" splitType="Stretch">
                <textField>
                    <reportElement style="style1" x="0" y="0" width="100" height="34"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{DOCUMENTID}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
    </jasperReport>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have style sheet with a class name changebackgroundcolor i want make change in
I'm trying to set the style name of the div of the split between
Background: Zen coding is apparently the name of a style of text-entry in an
I have an artist table and a style table. artist table: id name styleid
i am making style sheet for a website. css style name should be related
If a method takes a class/struct as an input parameter, what is the best
I would like to produce the following form style: Name Email [.................] [.................] Subject
Is there a way to get Style , a style name or just even
I want to get a list of objects which doesn't have some style name
Is there a built-in C# function to convert a dot-style domain name (my.domain.name) to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.