XSL-FO 设置内联文本的默认最小宽度
我正在编写 XSL-FO 文档,我想为一些内联元素设置最小宽度值。例如,在以下结构中
| FirstName: string1 LastName: string2 |
,其中“string1”和“string2”是来自我的 XML 的数据,“|”表示左边框和右边框,
| FirstName: John LastName: Smith |
| FirstName: LastName: Smith |
| FirstName: SomeVeryVeryLongFirstNameOfSomePerson LastName: Smith |
当各个人 (“John”、“Smith”、“” “Smith”、“SomeVery...”“Smith”)从 XML 加载。
基本上我需要这样的东西
<fo:block>
FirstName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline> LastName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline>
</fo:block>
,但这不起作用(最小宽度被忽略)。我在 fo:block 上尝试了 min-width,尝试了 inline-progression-dimension、block-progression-dimension、fo:table 的一些解决方法,但没有任何效果或者我做错了。我正在使用 Apache FOP 1.0。
有人可以帮忙吗? 提前致谢
i am writing the XSL-FO document and i want to set min-width values for some inline elements. For example, in the following structure
| FirstName: string1 LastName: string2 |
where "string1" and "string2" are data from my XML and "|"'s denotes left and right borders, i want the following results
| FirstName: John LastName: Smith |
| FirstName: LastName: Smith |
| FirstName: SomeVeryVeryLongFirstNameOfSomePerson LastName: Smith |
when respective peoples ("John" "Smith", "" "Smith", "SomeVery..." "Smith") are loaded from XML.
Basicaly i need something like this
<fo:block>
FirstName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline> LastName: <fo:inline min-width="50mm"> <xsl:value-of ...> </fo:inline>
</fo:block>
but this isn't working (min-width is ignored). I tried min-width on fo:block, tried inline-progression-dimension, block-progression-dimension, some workaround with fo:table but nothing works or i'm doing it wrong. I'm using Apache FOP 1.0.
Can anyone help?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了这个问题,经过在网络上的一些搜索,我发现了一个解决方案:使用具有所需宽度的 fo:inline-container 和 fo:block 在您放置文本的位置内:
只需替换
width
和selector
即可满足您的需求。此示例还包括我需要的底线,但它不是强制性的:如果不需要,只需从fo:block
中删除border-bottom
即可。请参阅如何获得内联 FO 的固定宽度? 了解原始内容解决方案和细节。I had this problem as well, and after some search on the web, I discovered a solution: use a
fo:inline-container
with the desired width and afo:block
inside where you put your text:Just replace the
width
andselector
to match your needs. This example also includes a bottom line, which I needed, but it is not mandatory: just remove theborder-bottom
fromfo:block
if you don't need it. See How get fixed width for inline FO? for the original solution and details.