FOP在正斜杠上未正确包装

时间:2018-10-31 15:20:27

标签: java xsl-fo apache-fop

我正在使用org.apache.xmlgraphics FOP的2.3生成表。 该表的其中一列包含一个复合标识符,该标识符包含由斜杠分隔的四个部分

注意:FOP 1.1也有同样的问题,但是我尝试升级。

使用以下代码段,我得到一个pdf文件(下图),其中在标识符为“ 100000000006 / / 32143214321 / DFSG”的一行中,未显示第二个正斜杠。我可以选择文本,并且所有的正斜杠都存在。

我的格式化错误是什么?

注意:如果我在所有空格之间使用带有文字的标识符,例如“ 100000000006/1/32143214321 / DFSG”所有文本均按预期显示。

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
                version="1.0">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
    <fo:root>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="spm1" page-height="595.45pt" page-width="792.0pt">
          <fo:region-body column-count="1" margin-bottom="57.6pt" margin-left="45.0pt" margin-right="45.0pt" margin-top="60pt" region-name="region-body"/>
          <fo:region-start extent="80pt" reference-orientation="90" region-name="regstart"/>
          <fo:region-end extent="80pt" reference-orientation="270" region-name="regend"/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="spm1">
        <fo:static-content flow-name="regstart">
          <fo:block/>
        </fo:static-content>
        <fo:static-content flow-name="regend">
          <fo:block/>
        </fo:static-content>
        <fo:flow flow-name="region-body">
          <fo:block background-color="white" color="black" font-family="Times New Roman, Times" font-size="12.0pt" font-style="normal" font-variant="normal"
                    font-weight="normal" orphans="2" text-align="start" text-decoration="none" text-indent="0pt" vertical-align="baseline" widows="2">

            <fo:block hyphenate="true" font-family="Arial, Helvetica" font-size="8pt">
              <fo:leader line-height="10pt"/>
            </fo:block>
            <fo:table>
              <fo:table-column column-width="65pt"/>
              <fo:table-column/>

              <fo:table-header>
                <fo:table-row height="14.4pt">
                  <fo:table-cell background-color="#CEDBF4" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt" font-weight="bold" keep-with-next="always">
                      patient
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell background-color="#CEDBF4" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt" font-weight="bold" keep-with-next="always">
                      total Fee Value
                    </fo:block>
                  </fo:table-cell>
                </fo:table-row>
              </fo:table-header>
              <fo:table-body>
                <fo:table-row height="14.4pt">
                  <fo:table-cell background-color="#E7EDFD" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt">
                      100000000006 / / 32143214321 / DFSG
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell background-color="#E7EDFD" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block text-align="right" hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt">
                      100.00&#160;UK Pound
                    </fo:block>
                  </fo:table-cell>
                </fo:table-row>
                <fo:table-row height="14.4pt">
                  <fo:table-cell background-color="#E7EDFD" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt">
                      100000000006 / 1 / 32143214321 / DFSG
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell background-color="#E7EDFD" border-color="#FFFFFF" border-style="solid" border-width="0.25pt" display-align="center"
                                 padding-left="5.4pt" padding-right="5.4pt">
                    <fo:block text-align="right" hyphenate="true" color="#000000" font-family="Arial, Helvetica" font-size="8pt">
                      100.00&#160;UK Pound
                    </fo:block>
                  </fo:table-cell>
                </fo:table-row>
              </fo:table-body>
            </fo:table>

          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
</xsl:stylesheet>

enter image description here

1 个答案:

答案 0 :(得分:1)

也许在out <- as.matrix(countphij[,-1, with = FALSE]) row.names(out) <- countphij[[1]] 中65pt的宽度不够?