Jump to content

Bold Static Text in a subreport HowTo


dshof

Recommended Posts

Hello,

Does anyone know how to Bold a Static text field in a subreport. When I check the Bold property box for the text field in the subreport it doesn't seem to recognize it when the report is printed. The subreport consists of two static text labels and two text fields populated from the arraylist. When I change the subreport to just contain the text field populated from the arraylist and I check the bold property box for that field it prints bold text. So, I do not understand what is going on. Any help would be appreciated.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Sometimes when we change the property value, it doesnt get reflected in the XML file. check your xml file and see if the <statictext> element has a <textElement><font> with isBold attribute set to "true". If not, though your Designer has this set, this change isnt getting reflected in the xml.  So make the changes accordingly and this should work.

Link to comment
Share on other sites

The XML document appears to have all the right elements but the Bold text is being ignored. See the attached source below.

Code:
<?xml version="1.0" encoding="UTF-8"  ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport		 name="WorkOrder_V.1.0_subreport2"		 columnCount="1"		 printOrder="Vertical"		 orientation="Portrait"		 pageWidth="535"		 pageHeight="842"		 columnWidth="535"		 columnSpacing="0"		 leftMargin="0"		 rightMargin="0"		 topMargin="0"		 bottomMargin="0"		 whenNoDataType="NoPages"		 isTitleNewPage="false"		 isSummaryNewPage="false">	<property name="ireport.scriptlethandling" value="0" />	<property name="ireport.encoding" value="UTF-8" />	<import value="java.util.*" />	<import value="net.sf.jasperreports.engine.*" />	<import value="net.sf.jasperreports.engine.data.*" />	<field name="dotNo" class="java.lang.String"/>	<field name="dotQty" class="java.lang.String"/>		<background>			<band height="0"  isSplitAllowed="true" >			</band>		</background>		<title>			<band height="0"  isSplitAllowed="true" >			</band>		</title>		<pageHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</pageHeader>		<columnHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</columnHeader>		<detail>			<band height="15"  isSplitAllowed="true" >				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >					<reportElement						x="32"						y="0"						width="80"						height="15"						key="textField-1"						isRemoveLineWhenBlank="true"/>					<box></box>					<textElement verticalAlignment="Middle">						<font isBold="false"/>					</textElement>				<textFieldExpression   class="java.lang.String"><![CDATA[$F{dotNo}]]></textFieldExpression>				</textField>				<staticText>					<reportElement						x="112"						y="0"						width="27"						height="15"						key="staticText-1"						isPrintRepeatedValues="false"						isPrintInFirstWholeBand="true"						isPrintWhenDetailOverflows="true"/>					<box></box>					<textElement verticalAlignment="Middle">						<font isBold="true"/>					</textElement>				<text><![CDATA[QTY:]]></text>				</staticText>				<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >					<reportElement						x="139"						y="0"						width="76"						height="15"						key="textField-2"						isRemoveLineWhenBlank="true"						isPrintWhenDetailOverflows="true"/>					<box></box>					<textElement verticalAlignment="Middle">						<font isBold="false"/>					</textElement>				<textFieldExpression   class="java.lang.String"><![CDATA[$F{dotQty}]]></textFieldExpression>				</textField>				<staticText>					<reportElement						mode="Opaque"						x="6"						y="0"						width="26"						height="14"						forecolor="#000000"						key="staticText-2"						isPrintRepeatedValues="false"						isPrintInFirstWholeBand="true"						isPrintWhenDetailOverflows="true"/>					<box></box>					<textElement verticalAlignment="Middle">						<font isBold="true"/>					</textElement>				<text><![CDATA[DOT:]]></text>				</staticText>			</band>		</detail>		<columnFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</columnFooter>		<pageFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</pageFooter>		<summary>			<band height="0"  isSplitAllowed="true" >			</band>		</summary></jasperReport>
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...