Java FOP未在前斜杠上正确缠绕
我正在使用org.apache.xmlgraphics FOP的2.3生成一个表。 表中的一列包含一个复合标识符,该标识符包含四个部分,用正斜杠分隔 注意:我在FOP的1.1版本中也遇到了同样的问题,但我已经尝试过升级 使用下面的代码片段,我在下面得到一个pdf图像,其中标识符为10000000006//32143214321/DFSG的一行中没有显示第二个正斜杠。我可以选择文本,并且所有正斜杠都存在 我的格式错误是什么 注意:如果我在所有空格之间使用带有文本的标识符,例如10000000006/1/32143214321/DFSG,则所有文本将按预期显示Java FOP未在前斜杠上正确缠绕,java,xsl-fo,apache-fop,Java,Xsl Fo,Apache Fop,我正在使用org.apache.xmlgraphics FOP的2.3生成一个表。 表中的一列包含一个复合标识符,该标识符包含四个部分,用正斜杠分隔 注意:我在FOP的1.1版本中也遇到了同样的问题,但我已经尝试过升级 使用下面的代码片段,我在下面得到一个pdf图像,其中标识符为10000000006//32143214321/DFSG的一行中没有显示第二个正斜杠。我可以选择文本,并且所有正斜杠都存在 我的格式错误是什么 注意:如果我在所有空格之间使用带有文本的标识符,例如10000000006
<?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 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 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>
也许在65pt中,宽度不够?我找到了一个网站,在那里我可以进行实验,通过去除颜色,我可以看到文本确实在那里。从其他stackoverflow FOP答案中,我发现添加一个零宽度空间&8203;在每个斜杠之后,第二个斜杠向下移动到一个新行,这对于我的用例来说已经足够好了。在这种情况下,强制长文本换行似乎很奇怪,但在这种情况下,它是强制单个字符换行。这仍然感觉不太正确,但它可以工作。听起来正斜杠可能无法识别为单词边界(即允许换行的字符),这可能是字体中的问题,也可能是FOP中的问题。谢谢。我确实试过了,但后来我发现了其他标识符实例的问题,但是如果你只是为了测试300或400点的宽度,那么第二个斜杠是可见的吗?上面的代码是一个更大的文件的子集,有11列,所以加宽列意味着我窃取了一列的空间,而其他列则丢失了空间。这就是为什么我需要触发包装的原因——正如我在对这个问题的评论中所说,我可以使用零宽度的空格来实现这一点——所以这就是我现在要做的。