首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

XSl-FO产生报表遇到常见有关问题汇总

2012-11-03 
XSl-FO产生报表遇到常见问题汇总1、划横线xsl:template nameDrawLinefo:block space-before-7pt s

XSl-FO产生报表遇到常见问题汇总

1、划横线

<xsl:template name="DrawLine"><fo:block space-before="-7pt" space-after="1pt"><fo:leader leader-pattern="rule" rule-style="dotted"rule-thickness="0.35pt" color="black" leader-length="100%" /></fo:block></xsl:template>

?

2、<!--报表每隔五行显示一条横线的方法 -->

<xsl:template name="ReportTable"><fo:block><fo:table><fo:table-column column-width="100pt" /><fo:table-column column-width="100pt" /><fo:table-column column-width="100pt" /><fo:table-header><fo:table-row><fo:table-cell><fo:block space-before="3pt" space-after="5pt"font-size="8pt" line-height="11pt"><xsl:value-of select="Year" /></fo:block></fo:table-cell><fo:table-cell><fo:block space-before="3pt" space-after="5pt"text-align="right" font-size="8pt" line-height="11pt"><xsl:value-of select="Additions" /></fo:block></fo:table-cell><fo:table-cell><fo:block space-before="3pt" space-after="5pt"text-align="right" font-size="8pt" line-height="11pt"><xsl:value-of select="Withdrawals" /></fo:block></fo:table-cell></fo:table-row></fo:table-header><fo:table-body><xsl:for-each select="//ts[@d!='-1']"><xsl:variable name="d"><xsl:value-of select="@d" /></xsl:variable><fo:table-row height="11pt"><fo:table-cell><fo:block font-size="8pt"><xsl:value-of select="$starYear + @d" /></fo:block></fo:table-cell><fo:table-cell><fo:block font-size="8pt" text-align="right"><xsl:value-of select="$starYear + @d" /></fo:block></fo:table-cell><fo:table-cell><fo:block font-size="8pt" text-align="right"><xsl:value-of select="$starYear + @d" /></fo:block></fo:table-cell></fo:table-row><xsl:if test="position() mod 5 = 0 and position() != last()"><fo:table-row><fo:table-cell number-columns-spanned="7"><fo:block space-before="-7pt" space-after="1pt"><fo:leader leader-pattern="rule" rule-style="dotted"rule-thickness="0.35pt" color="black" leader-length="100%" /></fo:block></fo:table-cell></fo:table-row></xsl:if></xsl:for-each></fo:table-body></fo:table></fo:block></xsl:template>

?

3、报表强行分页的方法

在fo:table-row 中添加break-after="page" 属性,则该row将从新的一页开始生成

?

4、黑顶的标题模板

<xsl:variable name="greyheader">rgb(217,217,217)</xsl:variable><xsl:template name="HeaderBar"><xsl:param name="Title" /><xsl:param name="Color" select="$greyheader" /><xsl:param name="Fontwt">bold</xsl:param><xsl:param name="Indent">3pt</xsl:param><xsl:param name="SpaceAfter">5pt</xsl:param><xsl:param name="FrameStyle" /><xsl:param name="Text" /><xsl:param name="TextFontSize" /><fo:table table-layout="fixed" space-after="{$SpaceAfter}"inline-progression-dimension.optimum="100%"><xsl:if test="$Color!=''"><xsl:attribute name="background-color">          <xsl:value-of select="$Color" />        </xsl:attribute></xsl:if><xsl:attribute name="font-size">        <xsl:choose><xsl:when test="$TextFontSize!=''"><xsl:value-of select="$TextFontSize" /></xsl:when>          <xsl:when test="$FrameStyle='large'">            <xsl:value-of select="$FtSzH2" />          </xsl:when>          <xsl:otherwise>            <xsl:value-of select="$FtSzH1" />          </xsl:otherwise>        </xsl:choose>      </xsl:attribute><xsl:attribute name="height">        <xsl:choose>          <xsl:when test="$FrameStyle='large'">12.5pt</xsl:when>          <xsl:otherwise>10.4pt</xsl:otherwise>        </xsl:choose>      </xsl:attribute><xsl:if test="$FrameStyle='large'"><xsl:attribute name="border-width">0pt</xsl:attribute></xsl:if><fo:table-column /><fo:table-body><fo:table-row keep-with-next="always"><xsl:attribute name="height">            <xsl:choose>              <xsl:when test="$FrameStyle='large'">3.5pt</xsl:when>              <xsl:otherwise>2pt</xsl:otherwise>            </xsl:choose>          </xsl:attribute></fo:table-row><fo:table-row keep-with-next="always"><fo:table-cell><fo:block font-weight="{$Fontwt}" text-indent="{$Indent}"space-after="0pt"><xsl:value-of select="$Title" /><xsl:if test="$Text != ''"><fo:inline font-weight="normal" white-space-collapse="false"><xsl:attribute name="font-size">                    <xsl:choose>                    <xsl:when test="$TextFontSize!=''"><xsl:value-of select="$TextFontSize" />                    </xsl:when>                      <xsl:when test="$FrameStyle='large'">                        <xsl:value-of select="$FtSzT2" />                      </xsl:when>                      <xsl:otherwise>                        <xsl:value-of select="$FtSzT0" />                      </xsl:otherwise>                    </xsl:choose>                  </xsl:attribute><xsl:text></xsl:text><xsl:value-of select="$Text" /></fo:inline></xsl:if></fo:block></fo:table-cell></fo:table-row></fo:table-body></fo:table></xsl:template>

?5?? SVG画曲线时在FOP不同版本显示不一样,为了显示正确,引入style属性进行配置虚线。

<svg:line stroke-width="0.15" stroke="#000000" x1="{$OriginX}" x2="{number($InnerCanvasWidth + $addmorespace - 3)}" y1="{number($InnerCanvasHeight - $addingScale + 6) }" y2="{number($InnerCanvasHeight - $addingScale + 6) }" style="stroke:black;fill:none;stroke-width:0.1;stroke-linecap:butt;stroke-dasharray:0.1,2;"/>

?

热点排行