Browse Source

映射背景、字体颜色;修复水平对齐、字体大小错误;元素高度*1.25

sunyj 8 years ago
parent
commit
4dc87d74d5
1 changed files with 40 additions and 6 deletions
  1. 40 6
      src/main/resources/crystal2jasper.xsl

+ 40 - 6
src/main/resources/crystal2jasper.xsl

@@ -258,8 +258,25 @@
 							<xsl:value-of select="round(@width div $positionRate)" />
 						</xsl:attribute>
 						<xsl:attribute name="height">
-							<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+							<xsl:value-of select="round(@height div $positionRate * 1.25)" />
 						</xsl:attribute>
+						<!-- color -->
+						<xsl:variable name="foreColor"
+							select="Element/Element/FontProperties/FontColor/@value" />
+						<xsl:variable name="backColor"
+							select="BorderProperties/BackgroundColor/@value" />
+						<xsl:if test="$foreColor">
+							<xsl:attribute name="forecolor">
+								<xsl:value-of
+								select="$foreColor mod 256 * 256 * 256 + floor($foreColor div 256) mod 256 * 256 + floor($foreColor div (256 * 256))" />
+							</xsl:attribute>
+						</xsl:if>
+						<xsl:if test="$backColor">
+							<xsl:attribute name="backcolor">
+								<xsl:value-of
+								select="$backColor mod 256 * 256 * 256 + floor($backColor div 256) mod 256 * 256 + floor($backColor div (256 * 256))" />
+							</xsl:attribute>
+						</xsl:if>
 					</reportElement>
 					<!-- border -->
 					<box topPadding="2" leftPadding="2" bottomPadding="2"
@@ -273,7 +290,7 @@
 					<!-- align -->
 					<textElement verticalAlignment="Middle">
 						<xsl:variable name="textAlignment"
-							select="CommonProperties/HorizontalAlign/@value" />
+							select="Element/CommonProperties/HorizontalAlign/@value" />
 						<!-- horizontal align -->
 						<xsl:if test="$textAlignment">
 							<xsl:attribute name="textAlignment">
@@ -287,7 +304,7 @@
 						<!-- font -->
 						<font fontName="Microsoft YaHei UI">
 							<!-- font size -->
-							<xsl:if test="FontProperties/FontSize">
+							<xsl:if test="Element/Element/FontProperties/FontSize/@value">
 								<xsl:attribute name="size"><xsl:value-of
 									select="round(Element/Element/FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
 							</xsl:if>
@@ -337,8 +354,25 @@
 							<xsl:value-of select="round(@width div $positionRate)" />
 						</xsl:attribute>
 						<xsl:attribute name="height">
-							<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+							<xsl:value-of select="round(@height div $positionRate * 1.25)" />
 						</xsl:attribute>
+						<!-- color -->
+						<xsl:variable name="foreColor"
+							select="Element/Element/FontProperties/FontColor/@value" />
+						<xsl:variable name="backColor"
+							select="BorderProperties/BackgroundColor/@value" />
+						<xsl:if test="$foreColor">
+							<xsl:attribute name="forecolor">
+								<xsl:value-of
+								select="$foreColor mod 256 * 256 * 256 + floor($foreColor div 256) mod 256 * 256 + floor($foreColor div (256 * 256))" />
+							</xsl:attribute>
+						</xsl:if>
+						<xsl:if test="$backColor">
+							<xsl:attribute name="backcolor">
+								<xsl:value-of
+								select="$backColor mod 256 * 256 * 256 + floor($backColor div 256) mod 256 * 256 + floor($backColor div (256 * 256))" />
+							</xsl:attribute>
+						</xsl:if>
 					</reportElement>
 					<!-- border -->
 					<box topPadding="2" leftPadding="2" bottomPadding="2"
@@ -352,7 +386,7 @@
 					<!-- align -->
 					<textElement verticalAlignment="Middle">
 						<xsl:variable name="textAlignment"
-							select="CommonProperties/HorizontalAlign/@value" />
+							select="Element/CommonProperties/HorizontalAlign/@value" />
 						<!-- horizontal align -->
 						<xsl:if test="$textAlignment">
 							<xsl:attribute name="textAlignment">
@@ -435,7 +469,7 @@
 							<xsl:value-of select="round(@width div $positionRate)" />
 						</xsl:attribute>
 						<xsl:attribute name="height">
-							<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+							<xsl:value-of select="round(@height div $positionRate)" />
 						</xsl:attribute>
 					</reportElement>
 					<!-- subreportParameter -->