JasperReports:某些信息在报告中重复显示
JasperReports: Some info were repeatedly displayed in the report
我正在使用 JasperReports 根据三个不同数据库中的数据生成一份简历。简历分为个人背景、职业背景和工作经历三个部分。个人背景和职业背景等细节不详table。但是,工作经历可以有多个条目,可以重复也可以不重复table.
我的输出有问题,因为我希望它像这样显示:
[个人背景]
信息
[职业背景]
信息
[工作经历]
工作经历1
信息
工作经历2
信息
但是,Personal Background 和 Career Background 对于每个 Work experience 1 和 2 都是重复的。我希望迭代只在 work experience 中,而不是三个都重复。
我只使用文本字段和框架(没有子报表、列表或 table 组件)。
我尝试创建子数据集,但不知道如何使用它。
我是 JasperReports 的新手,我被要求创建一个报告。
我希望得到最快的回应。那我会很高兴的。
这些是一些代码片段:
<queryString>
<![CDATA[SELECT user.user_id, user.name, user.image, user.email, user.department, user.birthday, user.location, user.system_role, user.date_updated, user.date_deleted, user.gender, user.course, user.college_end, user.awards, user.industry_start, user.school,
certification.uID,
certification.ACTION_Graduate ,
certification.JLPT_Level_Internal ,
certification.JLPT_Level_Official ,
proj_exp.uID ,
proj_exp.Customer_Name ,
proj_exp.Project_Name ,
proj_exp.Start_Date ,
proj_exp.End_Date ,
proj_exp.Project_Role_Project_Manager ,
proj_exp.Project_Role_Project_Consultant ,
proj_exp.Project_Role_Project_Leader ,
proj_exp.Project_Role_Sub_Leader
FROM user
JOIN certification ON
user.user_id = certification.`uID`
JOIN proj_exp ON
certification.`uID` = proj_exp.`uID`
WHERE
user.user_id = 1527257724]]>
</queryString>
.jrxml 代码的简化版本:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2015-11-18T10:33:04 -->
<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="atss_resume" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="efaabc27-78c1-480d-92f0-3de6a2ee75a6">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="atss"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<queryString>
<![CDATA[SELECT user.user_id, user.name, user.image, user.email, user.department, user.birthday, user.location, user.system_role, user.date_updated, user.date_deleted, user.gender, user.course, user.college_end, user.awards, user.industry_start, user.school,
certification.uID,
certification.ACTION_Graduate ,
certification.JLPT_Level_Internal ,
certification.JLPT_Level_Official ,
proj_exp.uID ,
proj_exp.Customer_Name ,
proj_exp.Project_Name ,
proj_exp.Start_Date ,
proj_exp.End_Date ,
proj_exp.Work_Location ,
proj_exp.Work_Location_Others ,
proj_exp.Project_Type ,
proj_exp.Project_Type_Others ,
proj_exp.Project_Role_Project_Manager ,
proj_exp.Project_Role_Project_Consultant ,
proj_exp.Project_Role_Project_Leader ,
proj_exp.Project_Role_Sub_Leader
FROM user
JOIN certification ON
user.user_id = certification.`uID`
JOIN proj_exp ON
certification.`uID` = proj_exp.`uID`
WHERE
user.user_id = 1527257724]]>
</queryString>
<field name="user_id" class="java.lang.Long">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="image" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="email" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="department" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="birthday" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="location" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="system_role" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="date_updated" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="date_deleted" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="gender" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="course" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="college_end" class="java.sql.Date">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="awards" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="industry_start" class="java.sql.Date">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="school" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="uID" class="java.lang.Long">
<fieldDescription><![CDATA[User ID]]></fieldDescription>
</field>
<field name="ACTION_Graduate" class="java.lang.Boolean">
<fieldDescription><![CDATA[ACTION Graduate]]></fieldDescription>
</field>
<field name="JLPT_Level_Internal" class="java.lang.Integer">
<fieldDescription><![CDATA[JLPT Level Internal 0: none 1: N5 / L4 2: N4 / L3 3: N3 4: N2 / L2 5: N1 / L1 JLPT Level Internal]]></fieldDescription>
</field>
<field name="JLPT_Level_Official" class="java.lang.Integer">
<fieldDescription><![CDATA[JLPT Level Official 0: none 1: N5 / L4 2: N4 / L3 3: N3 4: N2 / L2 5: N1 / L1 JLPT Level Official]]></fieldDescription>
</field>
<field name="COLUMN_21" class="java.lang.Long"/>
<field name="Customer_Name" class="java.lang.String">
<fieldDescription><![CDATA[Customer Name]]></fieldDescription>
</field>
<field name="Project_Name" class="java.lang.String">
<fieldDescription><![CDATA[Project Name]]></fieldDescription>
</field>
<field name="Start_Date" class="java.lang.String">
<fieldDescription><![CDATA[Start Date]]></fieldDescription>
</field>
<field name="End_Date" class="java.lang.String">
<fieldDescription><![CDATA[End Date]]></fieldDescription>
</field>
<field name="Work_Location" class="java.lang.Boolean">
<fieldDescription><![CDATA[1: Philippines 2: Japan 3: China 4: Others]]></fieldDescription>
</field>
<field name="Work_Location_Others" class="java.lang.String">
<fieldDescription><![CDATA[Work Location Others]]></fieldDescription>
</field>
<field name="Project_Type" class="java.lang.Boolean">
<fieldDescription><![CDATA[1: Development 2: Verification 3: Translation 4: Infra 5: Support]]></fieldDescription>
</field>
<field name="Project_Type_Others" class="java.lang.String">
<fieldDescription><![CDATA[Project Type Others]]></fieldDescription>
</field>
<field name="Project_Role_Project_Manager" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Manager (PM)]]></fieldDescription>
</field>
<field name="Project_Role_Project_Consultant" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Consultant / Advisor]]></fieldDescription>
</field>
<field name="Project_Role_Project_Leader" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Leader / Scrum Master (PL)]]></fieldDescription>
</field>
<field name="Project_Role_Sub_Leader" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Sub Leader (SL)]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="18" splitType="Stretch"/>
</title>
<pageHeader>
<band height="22" splitType="Stretch">
<staticText>
<reportElement x="40" y="4" width="100" height="10" uuid="95db4088-edf7-4b2e-a759-8e618c1492c7"/>
<textElement>
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[AWS Confidential]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="75" splitType="Stretch">
<textField>
<reportElement x="40" y="30" width="320" height="30" uuid="93d6debe-5114-47cf-bef8-a39c628e2117"/>
<textElement>
<font fontName="Times New Roman" size="20" isBold="true"/>
<paragraph leftIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="40" y="10" width="79" height="19" uuid="4564b3fc-d6b9-4178-9f95-fac5cbd37f88"/>
<textElement>
<font fontName="Times New Roman" size="16" isBold="true"/>
</textElement>
<text><![CDATA[PROFILE]]></text>
</staticText>
<image>
<reportElement x="422" y="7" width="72" height="60" uuid="09d1c125-7f6c-4f10-9fd3-f047d003ed99"/>
<imageExpression><![CDATA["C:/Users/kristian.bautista/JaspersoftWorkspace/MyReports/bin/AWS logo.png"]]></imageExpression>
</image>
</band>
</columnHeader>
<detail>
<band height="359" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement mode="Opaque" x="40" y="10" width="452" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="af1be546-40bb-44cc-8a44-f36fc222f70e"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Personal Background]]></text>
</staticText>
<frame>
<reportElement x="40" y="26" width="150" height="54" uuid="c5641bf3-e03b-4d3d-8863-3c338d875d6f">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<staticText>
<reportElement x="0" y="0" width="150" height="18" uuid="36d9f5d0-5722-4c96-adfe-b2db0f4a6c30"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Age]]></text>
</staticText>
<staticText>
<reportElement x="0" y="18" width="150" height="18" uuid="d4fbdaa2-de9f-457b-8422-f60063c216e6"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Gender]]></text>
</staticText>
<staticText>
<reportElement x="0" y="36" width="150" height="18" uuid="16316821-0aa5-4c0b-aa1d-8ac1fff51729"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Undergraduate Course]]></text>
</staticText>
</frame>
<staticText>
<reportElement mode="Opaque" x="40" y="113" width="452" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="05513f9a-6018-4730-b4ed-6ac48bac612e"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Career Background]]></text>
</staticText>
<frame>
<reportElement x="40" y="129" width="150" height="74" uuid="18c90b2c-4376-445c-9c2b-bdcd588228a2">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<staticText>
<reportElement x="0" y="0" width="150" height="26" uuid="76743f2b-0f74-4a94-b6d3-9a40b1e2b67a"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Years Working in Industry]]></text>
</staticText>
<staticText>
<reportElement x="0" y="26" width="150" height="24" uuid="62c04f1a-d664-408e-b809-9c6938bf34f7"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[English Language Skill]]></text>
</staticText>
<staticText>
<reportElement x="0" y="50" width="150" height="24" uuid="cb821738-3193-46c4-9f32-de20199e5a55"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Japanese Language Skill]]></text>
</staticText>
</frame>
<frame>
<reportElement x="190" y="26" width="302" height="54" uuid="082d0f9e-dad5-405e-ae60-17483e5c0623"/>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="302" height="18" uuid="9aeba03d-ea9e-4e02-9cd2-c32d620df0b0"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="18" width="302" height="18" uuid="2e79d960-147a-4d54-8a3e-e03e190e498a"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{gender}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="36" width="302" height="51" uuid="ad7c33b1-4ca1-4055-93f1-2d122ce5385f"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{course} + " (" + DATEFORMAT($F{college_end}, "MMM yyyy") + ") " + "\n" +
$F{school} + "\n" + "Awarded " + $F{awards}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="190" y="129" width="302" height="74" uuid="7fdb6ee8-f15d-4a36-90b0-14757690af9a"/>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="302" height="26" uuid="005615f1-e118-4348-83dc-1f44eb338960"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[YEARS($F{industry_start},TODAY( ))]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="26" width="302" height="24" uuid="4b64a97c-d01e-43e0-9cfa-749f7b2daaf4"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="50" width="302" height="24" uuid="c66829bf-5979-4fac-9fbc-753c5ea68f50"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{JLPT_Level_Official} == 1 ? "Japanese Language Proficiency - N5 Level":
$F{JLPT_Level_Official} == 2 ? "Japanese Language Proficiency - N4 Level":
$F{JLPT_Level_Official} == 3 ? "Japanese Language Proficiency - N3 Level":
$F{JLPT_Level_Official} == 4 ? "Japanese Language Proficiency - N2 Level":
$F{JLPT_Level_Official} == 5 ? "Japanese Language Proficiency - N1 Level": "none"]]></textFieldExpression>
</textField>
</frame>
<break>
<reportElement x="0" y="210" width="97" height="1" uuid="fcfa0301-1ee1-4633-9a9a-eff55911400f"/>
</break>
<frame>
<reportElement x="40" y="224" width="451" height="135" uuid="c8f2d1ae-cb0d-4cd8-ac4d-8dbd4ae2f26f"/>
<staticText>
<reportElement mode="Opaque" x="0" y="5" width="451" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="8757cd3c-3194-469f-9a3f-2c158cd1c4ec"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Work Experience]]></text>
</staticText>
<textField>
<reportElement x="11" y="30" width="429" height="19" uuid="9ad6fca5-7a33-49d5-a4f6-bbd5060169e7"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Project_Name} + " (" + $F{Start_Date} + " - " + $F{End_Date} + ") "]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="11" y="49" width="130" height="20" uuid="5399a915-d463-45b3-92f0-88f6ae35212c"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Project Description:]]></text>
</staticText>
<textField>
<reportElement x="41" y="69" width="330" height="20" uuid="7ce9748f-d059-4122-a917-98392c2bf60e"/>
<textElement>
<font fontName="Verdana"/>
</textElement>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="11" y="89" width="130" height="20" uuid="d79477cd-bdda-408a-b085-e0481fdfb836"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Responsibilities:]]></text>
</staticText>
<textField>
<reportElement x="41" y="109" width="330" height="20" uuid="0c2bd147-fc15-44bd-87ec-065b10f8eb1d">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement>
<font fontName="Verdana"/>
</textElement>
<textFieldExpression><![CDATA[($F{Project_Role_Project_Manager}?"Project Manager (PM)":null)+", "+
($F{Project_Role_Project_Consultant}?"Project Consultant / Advisor":null)+", "+
($F{Project_Role_Project_Leader}?"Project Leader / Scrum Master (PL)":null)+", "+
($F{Project_Role_Sub_Leader}?"Sub Leader (SL)":null)]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band height="23" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="353" y="5" width="70" height="30" uuid="60675991-82e8-45b5-9080-3d09285609e9"/>
<textElement textAlignment="Right">
<font fontName="Arial" size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="424" y="5" width="69" height="30" uuid="bd616de3-1e5d-4a30-8a28-a06cf0011598"/>
<textElement textAlignment="Left">
<font fontName="Arial" size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="24" splitType="Stretch"/>
</summary>
</jasperReport>
是的,frame
元素只是对元素进行分组的一种方式。
A frame is an element that can contain other elements and optionally draw a border around them. Since a frame is a container of other elements, in the document outline view the frame is represented as a node containing other elements.
所以您可能应该转向使用子报表或 table / 列表组件。我会回答
如何使用子报表获得预期的结果?
A subreport is a report included inside another report. This allows the creation of very complex layouts with different portions of a single document filled using different data sources and reports.
结构将是
在主报告中加载用户(仅用户,不加入其他 tables)并在 where 语句
中为所有用户显示 "Personal Background"
用户信息下方(始终在详细信息区域)包含一个通过 user id
的子报表。子报表是另一个报表,它从 certification
table 加载数据,使用 where
语句 users id
并显示“[Career Background]”
在子报告“[Career Background]”中,信息下方(始终在详细信息栏中)包含通过认证的子报告。uID
。子报表是另一个报表,它使用 proj_exp.uID
上的 where 语句从 proj_exp 加载数据,并显示相对于“[职业背景]”的“[工作经验]”
我不会完成您的代码,但会向您展示另一个子报表如何包含传递参数以及如何在该子报表中使用传递的参数执行另一个 sql
包括一个子报表(另一个报表)传递一个参数
<subreport>
<reportElement x="0" y="20" width="555" height="20" uuid="8ee71878-fc35-4991-a7dc-5199f23f2978"/>
<subreportParameter name="user_id">
<subreportParameterExpression><![CDATA[$F{user_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "certification.jasper"]]></subreportExpression>
</subreport>
备注:
我们正在将 $F{user_id}
传递给我们的子报表,该子报表将具有名称为 user_id
且相同的参数 class="java.lang.Long"
作为连接,我们传递 $P{REPORT_CONNECTION}
,与主报告相同的连接
子报表名称是certification.jrxml
,我们已经编译到certification.jasper
,因为我们需要将绝对路径传递给我们主报表中的子报表有一个名称为 SUBREPORT_DIR
的参数,其值类似于 c:/the path to our subreports/
子报表
<?xml version="1.0" encoding="UTF-8"?>
<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="subreport" language="java" pageWidth="555" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6afeba62-b470-4dfb-a8fb-42e2226b906d">
<parameter name="user_id" class="java.lang.Long"/>
<queryString>
<![CDATA[SELECT * FROM certification WHERE certification.`uID` = $P{user_id}]]>
</queryString>
<field name="uID" class="java.lang.Long">
<fieldDescription><![CDATA[User ID]]></fieldDescription>
</field>
.. all the other fields you like ...
<detail>
<band height="125" splitType="Immediate">
Here goes the textfields to display Career Background ] and below you included another subreport for the [ Work experience ] (same procedure as above)
</band>
</detail>
</jasperReport>
重复工作经验即可完成。
注意:
记得在执行主报表之前编译子报表(如果你使用IDE es.iReport,你按"preview"就足够了,它会为你编译报表。
当你包含一个子报表时,让高度变小(它会自动拉伸),这将帮助你在你喜欢的地方分页。
在子报表上设置正确的大小和边距。
当然还有其他方法可以实现您的结果,例如使用数据分组
<group name="User">
<groupExpression><![CDATA[$F{user_id}]]></groupExpression>
<groupHeader>
<band height="50">... texField .. with the user info</band>
</groupHeader>
</group>
或者使用像 <jr:table>
或 <jr:list>
这样的组件来定义它的数据源,但是现在(即使子报表方法不是最有效的方法,多重查询)我相信它是以最直接、最简单的方式达到您想要的结果。
我正在使用 JasperReports 根据三个不同数据库中的数据生成一份简历。简历分为个人背景、职业背景和工作经历三个部分。个人背景和职业背景等细节不详table。但是,工作经历可以有多个条目,可以重复也可以不重复table.
我的输出有问题,因为我希望它像这样显示:
[个人背景]
信息
[职业背景]
信息
[工作经历]
工作经历1
信息
工作经历2
信息
但是,Personal Background 和 Career Background 对于每个 Work experience 1 和 2 都是重复的。我希望迭代只在 work experience 中,而不是三个都重复。
我只使用文本字段和框架(没有子报表、列表或 table 组件)。 我尝试创建子数据集,但不知道如何使用它。
我是 JasperReports 的新手,我被要求创建一个报告。 我希望得到最快的回应。那我会很高兴的。
这些是一些代码片段:
<queryString>
<![CDATA[SELECT user.user_id, user.name, user.image, user.email, user.department, user.birthday, user.location, user.system_role, user.date_updated, user.date_deleted, user.gender, user.course, user.college_end, user.awards, user.industry_start, user.school,
certification.uID,
certification.ACTION_Graduate ,
certification.JLPT_Level_Internal ,
certification.JLPT_Level_Official ,
proj_exp.uID ,
proj_exp.Customer_Name ,
proj_exp.Project_Name ,
proj_exp.Start_Date ,
proj_exp.End_Date ,
proj_exp.Project_Role_Project_Manager ,
proj_exp.Project_Role_Project_Consultant ,
proj_exp.Project_Role_Project_Leader ,
proj_exp.Project_Role_Sub_Leader
FROM user
JOIN certification ON
user.user_id = certification.`uID`
JOIN proj_exp ON
certification.`uID` = proj_exp.`uID`
WHERE
user.user_id = 1527257724]]>
</queryString>
.jrxml 代码的简化版本:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2015-11-18T10:33:04 -->
<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="atss_resume" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="efaabc27-78c1-480d-92f0-3de6a2ee75a6">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="atss"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<queryString>
<![CDATA[SELECT user.user_id, user.name, user.image, user.email, user.department, user.birthday, user.location, user.system_role, user.date_updated, user.date_deleted, user.gender, user.course, user.college_end, user.awards, user.industry_start, user.school,
certification.uID,
certification.ACTION_Graduate ,
certification.JLPT_Level_Internal ,
certification.JLPT_Level_Official ,
proj_exp.uID ,
proj_exp.Customer_Name ,
proj_exp.Project_Name ,
proj_exp.Start_Date ,
proj_exp.End_Date ,
proj_exp.Work_Location ,
proj_exp.Work_Location_Others ,
proj_exp.Project_Type ,
proj_exp.Project_Type_Others ,
proj_exp.Project_Role_Project_Manager ,
proj_exp.Project_Role_Project_Consultant ,
proj_exp.Project_Role_Project_Leader ,
proj_exp.Project_Role_Sub_Leader
FROM user
JOIN certification ON
user.user_id = certification.`uID`
JOIN proj_exp ON
certification.`uID` = proj_exp.`uID`
WHERE
user.user_id = 1527257724]]>
</queryString>
<field name="user_id" class="java.lang.Long">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="image" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="email" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="department" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="birthday" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="location" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="system_role" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="date_updated" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="date_deleted" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="gender" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="course" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="college_end" class="java.sql.Date">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="awards" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="industry_start" class="java.sql.Date">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="school" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="uID" class="java.lang.Long">
<fieldDescription><![CDATA[User ID]]></fieldDescription>
</field>
<field name="ACTION_Graduate" class="java.lang.Boolean">
<fieldDescription><![CDATA[ACTION Graduate]]></fieldDescription>
</field>
<field name="JLPT_Level_Internal" class="java.lang.Integer">
<fieldDescription><![CDATA[JLPT Level Internal 0: none 1: N5 / L4 2: N4 / L3 3: N3 4: N2 / L2 5: N1 / L1 JLPT Level Internal]]></fieldDescription>
</field>
<field name="JLPT_Level_Official" class="java.lang.Integer">
<fieldDescription><![CDATA[JLPT Level Official 0: none 1: N5 / L4 2: N4 / L3 3: N3 4: N2 / L2 5: N1 / L1 JLPT Level Official]]></fieldDescription>
</field>
<field name="COLUMN_21" class="java.lang.Long"/>
<field name="Customer_Name" class="java.lang.String">
<fieldDescription><![CDATA[Customer Name]]></fieldDescription>
</field>
<field name="Project_Name" class="java.lang.String">
<fieldDescription><![CDATA[Project Name]]></fieldDescription>
</field>
<field name="Start_Date" class="java.lang.String">
<fieldDescription><![CDATA[Start Date]]></fieldDescription>
</field>
<field name="End_Date" class="java.lang.String">
<fieldDescription><![CDATA[End Date]]></fieldDescription>
</field>
<field name="Work_Location" class="java.lang.Boolean">
<fieldDescription><![CDATA[1: Philippines 2: Japan 3: China 4: Others]]></fieldDescription>
</field>
<field name="Work_Location_Others" class="java.lang.String">
<fieldDescription><![CDATA[Work Location Others]]></fieldDescription>
</field>
<field name="Project_Type" class="java.lang.Boolean">
<fieldDescription><![CDATA[1: Development 2: Verification 3: Translation 4: Infra 5: Support]]></fieldDescription>
</field>
<field name="Project_Type_Others" class="java.lang.String">
<fieldDescription><![CDATA[Project Type Others]]></fieldDescription>
</field>
<field name="Project_Role_Project_Manager" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Manager (PM)]]></fieldDescription>
</field>
<field name="Project_Role_Project_Consultant" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Consultant / Advisor]]></fieldDescription>
</field>
<field name="Project_Role_Project_Leader" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Project Leader / Scrum Master (PL)]]></fieldDescription>
</field>
<field name="Project_Role_Sub_Leader" class="java.lang.Boolean">
<fieldDescription><![CDATA[Project Role - Sub Leader (SL)]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="18" splitType="Stretch"/>
</title>
<pageHeader>
<band height="22" splitType="Stretch">
<staticText>
<reportElement x="40" y="4" width="100" height="10" uuid="95db4088-edf7-4b2e-a759-8e618c1492c7"/>
<textElement>
<font fontName="Arial" size="8"/>
</textElement>
<text><![CDATA[AWS Confidential]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="75" splitType="Stretch">
<textField>
<reportElement x="40" y="30" width="320" height="30" uuid="93d6debe-5114-47cf-bef8-a39c628e2117"/>
<textElement>
<font fontName="Times New Roman" size="20" isBold="true"/>
<paragraph leftIndent="0"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="40" y="10" width="79" height="19" uuid="4564b3fc-d6b9-4178-9f95-fac5cbd37f88"/>
<textElement>
<font fontName="Times New Roman" size="16" isBold="true"/>
</textElement>
<text><![CDATA[PROFILE]]></text>
</staticText>
<image>
<reportElement x="422" y="7" width="72" height="60" uuid="09d1c125-7f6c-4f10-9fd3-f047d003ed99"/>
<imageExpression><![CDATA["C:/Users/kristian.bautista/JaspersoftWorkspace/MyReports/bin/AWS logo.png"]]></imageExpression>
</image>
</band>
</columnHeader>
<detail>
<band height="359" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement mode="Opaque" x="40" y="10" width="452" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="af1be546-40bb-44cc-8a44-f36fc222f70e"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Personal Background]]></text>
</staticText>
<frame>
<reportElement x="40" y="26" width="150" height="54" uuid="c5641bf3-e03b-4d3d-8863-3c338d875d6f">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<staticText>
<reportElement x="0" y="0" width="150" height="18" uuid="36d9f5d0-5722-4c96-adfe-b2db0f4a6c30"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Age]]></text>
</staticText>
<staticText>
<reportElement x="0" y="18" width="150" height="18" uuid="d4fbdaa2-de9f-457b-8422-f60063c216e6"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Gender]]></text>
</staticText>
<staticText>
<reportElement x="0" y="36" width="150" height="18" uuid="16316821-0aa5-4c0b-aa1d-8ac1fff51729"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Undergraduate Course]]></text>
</staticText>
</frame>
<staticText>
<reportElement mode="Opaque" x="40" y="113" width="452" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="05513f9a-6018-4730-b4ed-6ac48bac612e"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Career Background]]></text>
</staticText>
<frame>
<reportElement x="40" y="129" width="150" height="74" uuid="18c90b2c-4376-445c-9c2b-bdcd588228a2">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<staticText>
<reportElement x="0" y="0" width="150" height="26" uuid="76743f2b-0f74-4a94-b6d3-9a40b1e2b67a"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Years Working in Industry]]></text>
</staticText>
<staticText>
<reportElement x="0" y="26" width="150" height="24" uuid="62c04f1a-d664-408e-b809-9c6938bf34f7"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[English Language Skill]]></text>
</staticText>
<staticText>
<reportElement x="0" y="50" width="150" height="24" uuid="cb821738-3193-46c4-9f32-de20199e5a55"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="9" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Japanese Language Skill]]></text>
</staticText>
</frame>
<frame>
<reportElement x="190" y="26" width="302" height="54" uuid="082d0f9e-dad5-405e-ae60-17483e5c0623"/>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="302" height="18" uuid="9aeba03d-ea9e-4e02-9cd2-c32d620df0b0"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="18" width="302" height="18" uuid="2e79d960-147a-4d54-8a3e-e03e190e498a"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{gender}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="36" width="302" height="51" uuid="ad7c33b1-4ca1-4055-93f1-2d122ce5385f"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{course} + " (" + DATEFORMAT($F{college_end}, "MMM yyyy") + ") " + "\n" +
$F{school} + "\n" + "Awarded " + $F{awards}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="190" y="129" width="302" height="74" uuid="7fdb6ee8-f15d-4a36-90b0-14757690af9a"/>
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="302" height="26" uuid="005615f1-e118-4348-83dc-1f44eb338960"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[YEARS($F{industry_start},TODAY( ))]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="26" width="302" height="24" uuid="4b64a97c-d01e-43e0-9cfa-749f7b2daaf4"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="0" y="50" width="302" height="24" uuid="c66829bf-5979-4fac-9fbc-753c5ea68f50"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{JLPT_Level_Official} == 1 ? "Japanese Language Proficiency - N5 Level":
$F{JLPT_Level_Official} == 2 ? "Japanese Language Proficiency - N4 Level":
$F{JLPT_Level_Official} == 3 ? "Japanese Language Proficiency - N3 Level":
$F{JLPT_Level_Official} == 4 ? "Japanese Language Proficiency - N2 Level":
$F{JLPT_Level_Official} == 5 ? "Japanese Language Proficiency - N1 Level": "none"]]></textFieldExpression>
</textField>
</frame>
<break>
<reportElement x="0" y="210" width="97" height="1" uuid="fcfa0301-1ee1-4633-9a9a-eff55911400f"/>
</break>
<frame>
<reportElement x="40" y="224" width="451" height="135" uuid="c8f2d1ae-cb0d-4cd8-ac4d-8dbd4ae2f26f"/>
<staticText>
<reportElement mode="Opaque" x="0" y="5" width="451" height="16" forecolor="#3688E0" backcolor="#E3DEDE" uuid="8757cd3c-3194-469f-9a3f-2c158cd1c4ec"/>
<box>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="12" isBold="true"/>
<paragraph leftIndent="10"/>
</textElement>
<text><![CDATA[Work Experience]]></text>
</staticText>
<textField>
<reportElement x="11" y="30" width="429" height="19" uuid="9ad6fca5-7a33-49d5-a4f6-bbd5060169e7"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Project_Name} + " (" + $F{Start_Date} + " - " + $F{End_Date} + ") "]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="11" y="49" width="130" height="20" uuid="5399a915-d463-45b3-92f0-88f6ae35212c"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Project Description:]]></text>
</staticText>
<textField>
<reportElement x="41" y="69" width="330" height="20" uuid="7ce9748f-d059-4122-a917-98392c2bf60e"/>
<textElement>
<font fontName="Verdana"/>
</textElement>
<textFieldExpression><![CDATA["Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="11" y="89" width="130" height="20" uuid="d79477cd-bdda-408a-b085-e0481fdfb836"/>
<textElement verticalAlignment="Middle">
<font fontName="Verdana" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Responsibilities:]]></text>
</staticText>
<textField>
<reportElement x="41" y="109" width="330" height="20" uuid="0c2bd147-fc15-44bd-87ec-065b10f8eb1d">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement>
<font fontName="Verdana"/>
</textElement>
<textFieldExpression><![CDATA[($F{Project_Role_Project_Manager}?"Project Manager (PM)":null)+", "+
($F{Project_Role_Project_Consultant}?"Project Consultant / Advisor":null)+", "+
($F{Project_Role_Project_Leader}?"Project Leader / Scrum Master (PL)":null)+", "+
($F{Project_Role_Sub_Leader}?"Sub Leader (SL)":null)]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band height="23" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="40" splitType="Stretch">
<textField>
<reportElement x="353" y="5" width="70" height="30" uuid="60675991-82e8-45b5-9080-3d09285609e9"/>
<textElement textAlignment="Right">
<font fontName="Arial" size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="424" y="5" width="69" height="30" uuid="bd616de3-1e5d-4a30-8a28-a06cf0011598"/>
<textElement textAlignment="Left">
<font fontName="Arial" size="8" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="24" splitType="Stretch"/>
</summary>
</jasperReport>
是的,frame
元素只是对元素进行分组的一种方式。
A frame is an element that can contain other elements and optionally draw a border around them. Since a frame is a container of other elements, in the document outline view the frame is represented as a node containing other elements.
所以您可能应该转向使用子报表或 table / 列表组件。我会回答
如何使用子报表获得预期的结果?
A subreport is a report included inside another report. This allows the creation of very complex layouts with different portions of a single document filled using different data sources and reports.
结构将是
在主报告中加载用户(仅用户,不加入其他 tables)并在 where 语句
中为所有用户显示 "Personal Background"用户信息下方(始终在详细信息区域)包含一个通过
user id
的子报表。子报表是另一个报表,它从certification
table 加载数据,使用where
语句users id
并显示“[Career Background]”在子报告“[Career Background]”中,信息下方(始终在详细信息栏中)包含通过认证的子报告。
uID
。子报表是另一个报表,它使用 proj_exp.uID
上的 where 语句从 proj_exp 加载数据,并显示相对于“[职业背景]”的“[工作经验]”
我不会完成您的代码,但会向您展示另一个子报表如何包含传递参数以及如何在该子报表中使用传递的参数执行另一个 sql
包括一个子报表(另一个报表)传递一个参数
<subreport>
<reportElement x="0" y="20" width="555" height="20" uuid="8ee71878-fc35-4991-a7dc-5199f23f2978"/>
<subreportParameter name="user_id">
<subreportParameterExpression><![CDATA[$F{user_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "certification.jasper"]]></subreportExpression>
</subreport>
备注:
我们正在将
$F{user_id}
传递给我们的子报表,该子报表将具有名称为user_id
且相同的参数class="java.lang.Long"
作为连接,我们传递
$P{REPORT_CONNECTION}
,与主报告相同的连接子报表名称是
certification.jrxml
,我们已经编译到certification.jasper
,因为我们需要将绝对路径传递给我们主报表中的子报表有一个名称为SUBREPORT_DIR
的参数,其值类似于c:/the path to our subreports/
子报表
<?xml version="1.0" encoding="UTF-8"?>
<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="subreport" language="java" pageWidth="555" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6afeba62-b470-4dfb-a8fb-42e2226b906d">
<parameter name="user_id" class="java.lang.Long"/>
<queryString>
<![CDATA[SELECT * FROM certification WHERE certification.`uID` = $P{user_id}]]>
</queryString>
<field name="uID" class="java.lang.Long">
<fieldDescription><![CDATA[User ID]]></fieldDescription>
</field>
.. all the other fields you like ...
<detail>
<band height="125" splitType="Immediate">
Here goes the textfields to display Career Background ] and below you included another subreport for the [ Work experience ] (same procedure as above)
</band>
</detail>
</jasperReport>
重复工作经验即可完成。
注意:
记得在执行主报表之前编译子报表(如果你使用IDE es.iReport,你按"preview"就足够了,它会为你编译报表。
当你包含一个子报表时,让高度变小(它会自动拉伸),这将帮助你在你喜欢的地方分页。
在子报表上设置正确的大小和边距。
当然还有其他方法可以实现您的结果,例如使用数据分组
<group name="User">
<groupExpression><![CDATA[$F{user_id}]]></groupExpression>
<groupHeader>
<band height="50">... texField .. with the user info</band>
</groupHeader>
</group>
或者使用像 <jr:table>
或 <jr:list>
这样的组件来定义它的数据源,但是现在(即使子报表方法不是最有效的方法,多重查询)我相信它是以最直接、最简单的方式达到您想要的结果。