Is it possible to use styles from .jrtx file in DynamicJasper?

风流意气都作罢 提交于 2019-12-11 08:57:59

问题


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.



来源:https://stackoverflow.com/questions/3829417/is-it-possible-to-use-styles-from-jrtx-file-in-dynamicjasper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!