sangeethanandu04 Posted April 19, 2018 Share Posted April 19, 2018 Iam using TIBCO jasper studio for generating excel report. I am not able to change the back color of a cell based on a condition. I can change the fontcolor by setting fontcolor="yellow" But backcolor="yellow" doesnt work. Can anyone help me? Link to comment Share on other sites More sharing options...
szaharia Posted April 19, 2018 Share Posted April 19, 2018 Make sure your element has the 'Transparent' checkbox unchecked in JasperStudio Properties --> Appearance tab. If this doesn't help, then please post your jrxml file here, if possible. Link to comment Share on other sites More sharing options...
sangeethanandu04 Posted April 19, 2018 Author Share Posted April 19, 2018 Followis my jrxml : Following is my entire jrxml: <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.2.2.final using JasperReports Library version 6.2.2 --> <!-- 2018-04-13T11:09:17 --> <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="DetectorStatusReport" pageWidth="992" pageHeight="595" orientation="Landscape" columnWidth="952" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ced95029-b569-4027-895c-af2843a4e088"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <property name="net.sf.jasperreports.export.xls.white.page.background" value="false" /> <style name="Title" fontName="Times New Roman" fontSize="50" isBold="true"/> <style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/> <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> <style name="Detail" fontName="Arial" fontSize="12"/> <style name="highlight1"> <conditionalStyle> <conditionExpression><![CDATA[$F{assoDet1}.equalsIgnoreCase( "1")]]></conditionExpression> <style mode="Opaque" backcolor="yellow"/> </conditionalStyle> <conditionalStyle> <conditionExpression><![CDATA[$F{assoDet2}.equalsIgnoreCase( "1")]]></conditionExpression> <style mode="Opaque" backcolor="yellow"/> </conditionalStyle> <conditionalStyle> <conditionExpression><![CDATA[$F{assoDet3}.equalsIgnoreCase( "1")]]></conditionExpression> <style mode="Opaque" backcolor="yellow"/> </conditionalStyle> </style> <parameter name="junctionName" class="java.lang.String"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <parameter name="frm_date" class="java.lang.String"/> <parameter name="to_date" class="java.lang.String"/> <queryString> <![CDATA[]]> </queryString> <field name="d1" class="java.lang.String"> <fieldDescription><![CDATA[d1]]></fieldDescription> </field> <field name="d2" class="java.lang.String"> <fieldDescription><![CDATA[d2]]></fieldDescription> </field> <field name="assoDet1" class="java.lang.String"> <fieldDescription><![CDATA[assoDet1]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="46" splitType="Stretch"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <frame> <reportElement mode="Opaque" x="-20" y="-20" width="1000" height="50" uuid="b87c1b65-3be3-42ce-885f-21b7d1f29a17"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> </reportElement> <staticText> <reportElement style="Title" positionType="Float" x="19" y="10" width="234" height="30" forecolor="#FFFFFF" uuid="bbd2692e-1dc1-49c7-b2a1-632af2ef9f16"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="16" isItalic="false" isUnderline="false"/> </textElement> <text><![CDATA[Detector Status Report of]]></text> </staticText> <textField> <reportElement style="Title" x="253" y="10" width="170" height="30" forecolor="#FFFFFF" uuid="dcb43670-d7cf-4f90-86a7-c309c36f294a"/> <textElement verticalAlignment="Middle"> <font size="16"/> </textElement> <textFieldExpression><![CDATA[$P{junctionName}]]></textFieldExpression> </textField> <staticText> <reportElement x="434" y="4" width="40" height="20" forecolor="#FFFFFF" uuid="ba7b5931-84f5-450e-aac8-9df1a0284ea0"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font fontName="Times New Roman"/> </textElement> <text><![CDATA[From:]]></text> </staticText> <staticText> <reportElement x="434" y="25" width="41" height="20" forecolor="#FFFFFF" uuid="255a4119-bc96-4b89-ad3f-5bdec46a0d12"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font fontName="Times New Roman"/> </textElement> <text><![CDATA[To:]]></text> </staticText> <textField> <reportElement x="474" y="4" width="102" height="20" forecolor="#FFFFFF" uuid="fd0e002e-6e43-429e-aca3-a55ed00b3ec3"/> <textElement verticalAlignment="Middle"> <font fontName="Times New Roman"/> </textElement> <textFieldExpression><![CDATA[$P{frm_date}]]></textFieldExpression> </textField> <textField> <reportElement x="475" y="25" width="101" height="20" forecolor="#FFFFFF" uuid="03165034-543c-4a51-bc54-004105ecc771"/> <textElement verticalAlignment="Middle"> <font fontName="Times New Roman"/> </textElement> <textFieldExpression><![CDATA[$P{to_date}]]></textFieldExpression> </textField> </frame> </band> </title> <pageHeader> <band splitType="Stretch"/> </pageHeader> <columnHeader> <band height="35" splitType="Stretch"> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/> <frame> <reportElement x="0" y="-3" width="960" height="30" uuid="8c3a60a6-57fa-48a1-9109-985db3a2e591"/> <reportElement style="Column header" x="330" y="0" width="20" height="27" forecolor="#736343" uuid="5049e8a5-21bb-4244-8cd5-f2ccb6efd3e1"/> <textElement textAlignment="Center"> <font size="10"/> </textElement> <text><![CDATA[D1]]></text> </staticText> <staticText> <reportElement style="Column header" x="350" y="0" width="17" height="27" forecolor="#736343" uuid="bdbe019d-99fd-4800-8ac4-a78c4aae68cb"/> <textElement textAlignment="Center"> <font size="10"/> </textElement> <text><![CDATA[D2]]></text> </staticText> </frame> </band> </columnHeader> <detail> <band height="30" splitType="Stretch"> <frame> <reportElement mode="Opaque" x="0" y="0" width="960" height="30" uuid="a98495d8-3c8d-4fa0-81f5-30c3efc2f766"/> <textFieldExpression><![CDATA[$F{d1}]]></textFieldExpression> </textField> <textField> <reportElement style="highlight1" x="350" y="0" width="17" height="30" uuid="03e139a2-8e8f-465f-b4bb-80ad55da9064"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression><![CDATA[$F{d2}]]></textFieldExpression> </textField> </frame> </band> </detail></jasperReport><?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?> Link to comment Share on other sites More sharing options...
szaharia Posted April 19, 2018 Share Posted April 19, 2018 Since the elements are not transparent, the other possibility is that the Excel exporter was set to ignore cells background. To override this setting, add the following property in your JRXML file:<property name="net.sf.jasperreports.export.xls.ignore.cell.background" value="false"/> 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