I'm using DynamicJasper to generate some reports on the fly and I'd like to use my .jrtx template. Is there a way to do that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, you can use .jrtx
tempalte. I had used it for formatting the text in my report. Here's a sample file for your reference.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd">
<jasperTemplate>
<style name="AddressAndGreenBarText" isDefault="false" forecolor="#000000" backcolor="#FFFFFF" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman"/>
<style name="BodyLetterTextAndBullet" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="11" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman"/>
<style name="Footer" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman"/>
<style name="BodyLetterLabels" isDefault="false" forecolor="#000000" backcolor="#FFFFFF" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="11" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Bold"/>
<style name="Signature" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="28" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="AnkeCalligraph.ttf"/>
<style name="ColumnAndGreenBarLabels" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Bold"/>
<style name="PhoneNumber" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Times New Roman" fontSize="15" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Bold"/>
<style name="GeneralFont" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Arial" fontSize="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="OtherHeading" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Arial" fontSize="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="SubHeading" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Heading" isDefault="false" forecolor="#000000" hAlign="Left" vAlign="Top" rotation="None" lineSpacing="Single" fontName="Arial" fontSize="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
</jasperTemplate>
Go to Report Inspector -> Styles -> Add -> Style Reference. You can add the .jrtx
file here.
Let me know if need any other help.