Browse Source

Makroberichte erstellen inkl.Excel-tauglicher Reiternamen #2

rpta_0.1_Release
Daniel Quathamer 1 year ago
parent
commit
c2ca84337b
  1. 11
      src-modules/module/rpta/schluesseltabellen/sx_stylesheets_einfuegen.sql
  2. 56
      superx/xml/rpta_templates.xsl
  3. 200
      superx/xml/tabelle_jrxml_book_without_cover.xsl

11
src-modules/module/rpta/schluesseltabellen/sx_stylesheets_einfuegen.sql

@ -17,6 +17,17 @@ @@ -17,6 +17,17 @@
"stylesheet_type":"XSL_JRXML",
"jr_datasource":""
},
{"filename":"tabelle_jrxml_book_without_cover.xsl",
"caption":"Booklet aus Makrobericht",
"description":"Makrobericht zu Excel-Tabellen",
"relation":"table",
"contenttype":"text/xml",
"is_generic":"1",
"toolbar_icon_filepath":"",
"usage_resultset_data":"T",
"stylesheet_type":"XSL_JRXML",
"jr_datasource":""
},
{"filename":"rpta_assistent.xsl",
"caption":"Berichtsassistent",
"description":"Export als formatierter Bericht",

56
superx/xml/rpta_templates.xsl

@ -799,6 +799,62 @@ isIgnorePagination="{$isIgnorePagination}" > @@ -799,6 +799,62 @@ isIgnorePagination="{$isIgnorePagination}" >
<queryString language="xPath"><xsl:value-of select="concat('/ergebnisse/ergebnis/ergebniselement[@ordnr=',$quote,$ordnr,$quote,']/sqlerg/row',$rowfilter)" />
</queryString>
</xsl:template>
<xsl:template name="createExcelSheetname">
<!-- kopiert von de.superx.servlet.XmlTransformer.createExcelSheetname(String)-->
<xsl:param name="mystring" />
<xsl:variable name="s1">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$mystring" />
<xsl:with-param name="search" select="'/'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s2">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s1" />
<xsl:with-param name="search" select="'\'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s3">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s2" />
<xsl:with-param name="search" select="'?'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s4">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s3" />
<xsl:with-param name="search" select="'*'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s5">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s4" />
<xsl:with-param name="search" select="'['" />
<xsl:with-param name="replace" select="'('" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s6">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s5" />
<xsl:with-param name="search" select="']'" />
<xsl:with-param name="replace" select="')'" />
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="trunc_string">
<xsl:with-param name="maxlength" select="27" />
<xsl:with-param name="mystring" select="$s6"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="trunc_string">
<xsl:param name="maxlength" select="28" />
<xsl:param name="mystring" />

200
superx/xml/tabelle_jrxml_book_without_cover.xsl

@ -0,0 +1,200 @@ @@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://jasperreports.sourceforge.net/jasperreports"
>
<xsl:import href="xsl_functions.xsl" />
<xsl:import href="rpta_templates.xsl" />
<xsl:param name="OUTFILE" select="'_sub_'" />
<xsl:param name="seitenbreite" select="842" />
<xsl:param name="seitenhoehe" select="595" />
<xsl:param name="seitenrand" select="12" />
<xsl:param name="isIgnorePagination" select="'true'" />
<xsl:param name="orientation" select="'Landscape'" />
<xsl:param name="stylesFile" select="'simple_table.jrtx'" />
<xsl:param name="font" select="'Liberation Sans'" /><!--TODO Arial als style-->
<!--Die Breite der Tabelle in pixel bei A4 Querformat:-->
<!-- Wenn keine Spaltenbreite definiert ist, wird 12 (Einheit Applet-Breite) verwendet. -->
<xsl:param name="std_spaltenbreite" select="'12'" />
<xsl:param name="std_zeilenhoehe_header" select="30" />
<xsl:param name="std_zeilenhoehe_tablerow" select="20" />
<!--<xsl:output method="xml" name="xml"/>-->
<xsl:output method="xml" encoding="UTF-8" name="xml" indent="true" />
<!--<xml:output method="xml" name="text" />
<xsl:output indent="yes"/>-->
<xsl:template match="/">
<xsl:variable name="druckbreite" select="$seitenbreite - (2 * $seitenrand)"></xsl:variable>
<xsl:choose>
<xsl:when test="/ergebnisse/@isMakro='true'">
<!-- first create main report-->
<xsl:call-template name="generateJasperReportMainReport" >
<xsl:with-param name="isMacroReport" select="'true'" />
<xsl:with-param name="ergebniselementOrdnr" select="0" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="std_zeilenhoehe_tablerow" select="$std_zeilenhoehe_tablerow" />
</xsl:call-template>
<!--output documents klappt noch nicht-->
<!--
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement">
<xsl:variable name="filename" select="concat($OUTFILE,@ordnr,'.jrxml')"/>
Generiere <xsl:value-of select="$filename"/><xsl:text>
</xsl:text>
<xsl:result-document href="{$filename}" format="text" method="text">
<xsl:call-template name="generateJasperReport" >
<xsl:with-param name="isMacroReport" select="'false'" />
<xsl:with-param name="ergebniselementOrdnr" select="@ordnr" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
-->
</xsl:when>
<xsl:otherwise>
<!--no macro, one single table-->
<xsl:call-template name="generateJasperReport" >
<xsl:with-param name="isMacroReport" select="'false'" />
<xsl:with-param name="ergebniselementOrdnr" select="0" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="std_zeilenhoehe_tablerow" select="$std_zeilenhoehe_tablerow" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generateJasperReportMainReport">
<xsl:param name="isMainReport" select="'true'" />
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:param name="druckbreite" select="812" />
<xsl:param name="seitenbreite" select="842" />
<xsl:param name="seitenhoehe" select="595" />
<xsl:param name="seitenrand" select="12" />
<xsl:param name="isIgnorePagination" select="'true'" />
<xsl:param name="orientation" select="'Landscape'" />
<xsl:param name="stylesFile" select="'simple_table.jrtx'" />
<xsl:param name="font" select="'Liberation Sans'" /><!--TODO Arial als style-->
<!--Die Breite der Tabelle in pixel bei A4 Querformat:-->
<!-- Wenn keine Spaltenbreite definiert ist, wird 12 (Einheit Applet-Breite) verwendet. -->
<xsl:param name="std_spaltenbreite" select="'12'" />
<xsl:param name="std_zeilenhoehe_header" select="30" />
<xsl:param name="std_zeilenhoehe_tablerow" select="20" />
<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="{/ergebnisse/ergebnis[@ordnr=$ergebniselementOrdnr]/maskenname}"
language="groovy"
pageWidth="{$seitenbreite}"
pageHeight="{$seitenhoehe}"
orientation="{$orientation}"
columnWidth="{$druckbreite}"
leftMargin="{$seitenrand}"
rightMargin="{$seitenrand}"
topMargin="{$seitenrand}"
bottomMargin="{$seitenrand}"
isIgnorePagination="{$isIgnorePagination}"
sectionType="Part">
<xsl:call-template name="jr_properties" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.2" value="pageFooter"/>
<!-- zum Testen-->
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="TUHH_kennz_bericht_ba"/>
<!--<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="466"/>
<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="522"/>-->
<template><xsl:value-of select="concat('&quot;',$stylesFile,'&quot;')" /></template>
<xsl:call-template name="jr_styles" />
<xsl:call-template name="querystring">
<xsl:with-param name="ordnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="rownr" select="1" />
</xsl:call-template>
<xsl:call-template name="jr_fields_report_level" />
<xsl:call-template name="jr_fields" >
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="isMacroReport" select="/ergebnisse/@isMakro" />
</xsl:call-template>
<!-- kein Deckblatt -->
<detail>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement">
<xsl:variable name="filename" select="concat(/ergebnisse/makro/@id,$OUTFILE,@ordnr)"/>
<part>
<partNameExpression><xsl:text>"</xsl:text><xsl:value-of select="@ordnr+1"/><xsl:text> </xsl:text>
<xsl:call-template name="createExcelSheetname">
<xsl:with-param name="mystring" select="../maskenname"/>
</xsl:call-template>
<xsl:text>"</xsl:text></partNameExpression>
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportParameter name="REPORT_CONNECTION">
<subreportParameterExpression><![CDATA[$P{REPORT_CONNECTION}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_LOCALE">
<subreportParameterExpression><![CDATA[$P{REPORT_LOCALE}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_DATA_DOCUMENT">
<subreportParameterExpression><![CDATA[$P{XML_DATA_DOCUMENT}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_LOCALE">
<subreportParameterExpression><![CDATA[Locale.ENGLISH]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_NUMBER_PATTERN">
<subreportParameterExpression><![CDATA["#0.######"]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="ordnr">
<subreportParameterExpression><xsl:text>"</xsl:text><xsl:value-of select="@ordnr"/><xsl:text>"</xsl:text></subreportParameterExpression>
</subreportParameter>
<subreportExpression><xsl:text>"</xsl:text><xsl:value-of select="concat($filename,'.jasper')"/><xsl:text>"</xsl:text></subreportExpression>
</p:subreportPart>
</part>
<!-- now create the subreports -->
<xsl:result-document href="{concat($filename,'.jrxml')}" format="xml" method="xml">
<xsl:call-template name="generateJasperReport" >
<xsl:with-param name="isMainReport" select="'false'" />
<xsl:with-param name="ergebniselementOrdnr" select="@ordnr" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="std_zeilenhoehe_tablerow" select="$std_zeilenhoehe_tablerow" />
</xsl:call-template>
</xsl:result-document>
</xsl:for-each>
</detail>
</jasperReport>
</xsl:template>
<!--Beispiel überlagere das Standard Template:
<xsl:template name="tableRowStyle">
<xsl:param name="flavorTableRowStyle" select="'listAlternatingBg'" />
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:choose>
<xsl:when test="$ergebniselementOrdnr=0">
<style name="TableRowDetail" mode="Opaque" forecolor="#000000" backcolor="#FFFFFF" hTextAlign="Right" vTextAlign="Middle" isBlankWhenNull="true" fontName="Liberation Sans" fontSize="8">
<box rightPadding="2">
<pen lineColor="#FFFFFF"/>
</box>
<paragraph leftIndent="2" rightIndent="1" spacingBefore="0" spacingAfter="0"/>
<conditionalStyle>
<conditionExpression><![CDATA[$F{tab_0Deckblatt Kennzahlenbericht Studiengänge}.contains("Ausw") || $F{tab_0Deckblatt Kennzahlenbericht Studiengänge}.contains("Parameter")]]></conditionExpression>
<style isBold="true"/>
</conditionalStyle>
<conditionalStyle>
<conditionExpression><![CDATA[Boolean.valueOf( $V{PAGE_COUNT} % 2 == 1 )]]></conditionExpression>
<style mode="Opaque" forecolor="#000000" backcolor="#E3E8EB"/>
</conditionalStyle>
</style>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$flavorTableRowStyle='listAlternatingBg'">
<style name="TableRowDetail" mode="Opaque" forecolor="#000000" backcolor="#FFFFFF" hTextAlign="Right" vTextAlign="Middle" isBlankWhenNull="true" fontName="{$font}" fontSize="8">
<box rightPadding="2">
<pen lineColor="#FFFFFF"/>
</box>
<paragraph leftIndent="2" rightIndent="1" spacingBefore="0" spacingAfter="0"/>
<conditionalStyle>
<conditionExpression><![CDATA[Boolean.valueOf( $V{PAGE_COUNT} % 2 == 1 )]]></conditionExpression>
<style mode="Opaque" forecolor="#000000" backcolor="#E3E8EB"/>
</conditionalStyle>
</style>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>-->
</xsl:stylesheet>
Loading…
Cancel
Save