Chi*_*uiz 9 fonts jasper-reports export-to-pdf jaspersoft-studio
我正在使用Jaspersoft Studio 5.2,我使用Courier New字体进行了报告,当我将其导出为PDF时,它将字体更改为Arial.
我只使用Studio工具.当我预览报告是可以的,但是当我导出它时就会发生.
如何使用Courier New字体导出我的报告?
我在报告中使用的textField模型:
<textField pattern="dd/MM/yyyy HH:mm:ss">
<reportElement uuid="f50b279a-b480-498f-8af7-be7e23c4b80b" x="415" y="11" width="105" height="10"/>
<textElement>
<font fontName="Courier New" size="8"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
Run Code Online (Sandbox Code Playgroud)
Ale*_*x K 20
您应该使用Font Extensions机制.
您应该使用Window - > Preferences对话框创建一个新字体:
使用" 字体系列"对话框,您可以为字体设置ttf文件:
您应该在上下文菜单的帮助下创建一个新样式:
之后,您可以设置此样式的字体:
之后你可以使用这种新风格:
该JRXML文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<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="test_courier" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2010b76c-0fe5-4a27-9c86-6846a6f9cc6a">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<style name="CustomFont" fontName="Courier New"/>
<queryString>
<![CDATA[select task from tasks]]>
</queryString>
<field name="TASK" class="java.lang.String"/>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement uuid="9205f787-f3b4-4b21-b2d9-19f52824e187" style="CustomFont" x="280" y="36" width="70" height="20"/>
<textElement/>
<text><![CDATA[Title]]></text>
</staticText>
</band>
</title>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="f23e8674-c45d-4dc7-92f3-93e5d0b41c16" style="CustomFont" x="0" y="0" width="70" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{TASK}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Run Code Online (Sandbox Code Playgroud)
该报告在Studio中的设计:
结果将是(由Jaspersoft Studion生成并在Adobe Reader中打开的pdf文件):
注意:
您可以在此处找到有关Font Extensions的更多信息
归档时间: |
|
查看次数: |
28592 次 |
最近记录: |