I use label to set Chinese and use bold to make the character bold,it has effect in ireport software,but there is no effect when I print it in pdf.
<staticText>
<reportElement uuid="20445ac6-99f7-44aa-9e7f-f9b658decf3b" x="0" y="0" width="554" height="23"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[学生预防性体检结果]]></text>
</staticText>
I select microsoft yahei fonts as my Chinese font , simsun font as my text field fonts ,put wryh.jar under the libs of project and the fonts can be seen bold when i printview it in pdf .My problem is solved.thanks everyone
Related
I use Jasper Reports to generate RTF file.
In RTF each textField is represented as separate box:
I tried to use one frame for textFields:
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="220" y="45" width="406" height="75"/>
<textField>
<reportElement positionType="Float" x="0" y="0" width="406" height="60"/>
<textElement>
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression><![CDATA["Address:"]]></textFieldExpression>
</textField>
<textField hyperlinkType="Reference" hyperlinkTarget="Blank">
<reportElement x="0" y="57" width="200" height="15" key="textWithStyle" style="LinkField"/>
<textElement>
<font fontName="Arial" size="8" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA["here"]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA["http:adress"]]></hyperlinkReferenceExpression>
</textField>
</frame>
But textFields also in the different boxes.
Is it possible to combine several textFields into one box like the following?
I know that I can add each text to one textField, but sometimes I need two separate textFields that I can manage inside one box.
I am using jasper stuido 6 to generated excel report.
After generating report I am getting green mark on cell wherever is number is coming as shown below image
same green mark is not coming from text value only.
I tried to set the below jasper property
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
and used below code
<jr:column width="50" uuid="d3d82c7c-1121-474f-b0f3-00e80cda4489">
<jr:detailCell height="20">
<textField>
<reportElement style="WhiteBackColor" x="0" y="0" width="50" height="20" uuid="1b71e76d-8111-43ee-9cfb-9070ffcf1f6d">
<printWhenExpression><![CDATA[$F{zeitQuartal}.matches("-?\\d+(\\.\\d+)?")]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="Calibri" size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[Double.parseDouble($F{zeitQuartal})]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
Then green mark disapper from the generated excel report
but if any text like come in between number that is disappearing
Using jasper reports (1.3) together with itext library (1.3.1) to make pdf reports. Font is defined as follows:
<reportFont name="font-normal" isDefault="true" fontName="Code2000" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="CODE2000.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
We explicitly set isBold="true", however nothing in the report is bold. The font CODE2000.TTF can be used in MS Word with bold style. We also tried without success setting isBold="true" on the element inside like in:
<textField>
<reportElement positionType="Float" x="0" y="120" width="694" height="14"/>
<textElement>
<font size="9" pdfFontName="CODE2000.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String">
"TITLE:"+str($P{title})
</textFieldExpression>
</textField>
Any help is appreciated.
I'm developing a Jasper report that has to be exported as a PDF from my web app.
The jasperreport.version is 5.5.1 and the web app is running on a Tomcat6 instance.
I've defined the following elements in my .jrxml:
<rectangle>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="415" y="21" width="140" height="28" uuid="52ceec4a-26bb-4efa-a4d2-af32c107d1d3"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true">
<reportElement style="label" positionType="Float" x="415" y="20" width="140" height="14" uuid="f1394c5b-4921-4ccd-84ed-b1d3e44dc499"/>
<textElement markup="none">
<font size="9" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{nivel.gestao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="campo" positionType="Float" stretchType="RelativeToTallestObject" x="415" y="34" width="140" height="15" uuid="3e1d2402-8b21-4f8e-9ee8-d57f1a870077"/>
<box bottomPadding="2"/>
<textElement verticalAlignment="Middle" markup="none">
<font size="9" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{nivelGestao}]]></textFieldExpression>
</textField>
The problem is that Jasper renders the text with line breaks depending on which font family I use.
Using Helvetica:
Using Courier (the font I need):
How can I use the Courier font family and avoid the unintended line breaks?
Text with Courier font is wider. I suppose if you write some long text with Helvetica you see same stuff. Check out padding and margins.
And remove <box bottomPadding="2"/>.
I have a report with a "header" style:
<style name="header" mode="Opaque" forecolor="#FFFFFF" backcolor="#15315B" vAlign="Middle" fontName="Arial" fontSize="10" isBold="true"/>
It is correctly displayed when I create a PDF report (JRPdfExporter), but when I create a XLSX report (JRXlsxExporter), the text stay in black and not in bold instead of white and bold...
I use jasperreport 5.6.
Example of text using the style:
<staticText>
<reportElement style="header" x="0" y="0" width="100" height="20" uuid="b5ee91c1-614a-40f8-96d3-2f626544e7c1"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Field]]></text>
</staticText>
I have updated jasperreport to version 6.0.3 and it now works...