xsl-fo header - 图像位于左侧,三行文本位于右侧,顶部对齐
使用apache FOP,想要创建一个标题,其中徽标左对齐,三行地址右对齐,两者都顶部对齐。
如果在流程内部完成,以下工作正常,但在静态内容标头(“xsl-region-before”)中,它会得到左侧和右侧的内容。正确,但将徽标对齐在地址块下方,就好像表定义被完全忽略一样。
我尝试过其他选项,例如尝试内联这两个选项,或使用浮点数,但结果相似。标头只是将它们视为单独的块并将它们堆叠起来。有人有什么建议吗?
我发现另一个问题询问了有关页脚的相同问题,可惜没有回复: 需要插播-foreign-object 和文本都与 XSL-FO 中的底部对齐
相关代码片段如下:
<fo:layout-master-set>
<fo:simple-page-master page-height="8.5in" page-width="11in" master-name="only" margin=".5in .5in .5in .5in">
<fo:region-body region-name="xsl-region-body" margin-top="1in" margin-bottom=".5in"/>
<fo:region-before region-name="xsl-region-before"/>
<fo:region-after region-name="xsl-region-after"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="only">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="7pt">
<fo:table width="10in">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:external-graphic src="img/print_logo.png" content-width="2in"/>
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center">
<fo:block text-align="right">
123 Credibility Street
</fo:block>
<fo:block text-align="right">
Chicago, IL 60606
</fo:block>
<fo:block text-align="right">
312-123-4567
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:static-content>
Using apache FOP, want to create a header with a logo aligned left, three-line address aligned right, both aligned top.
Following works ok if done inside of flow, but in a static-content header ('xsl-region-before') it gets the left & right correct but aligns the logo below the address block, as if the table definition were being ignored completely.
I've tried other options, like trying to inline the two, or use floats, with similar results. The header just treats them like separate blocks and stacks them. Anyone have any suggestions?
I found this other issue asking the same question about footers, alas no replies:
Need instream-foreign-object and text to both align to the bottom in XSL-FO
Relevant snippet follows:
<fo:layout-master-set>
<fo:simple-page-master page-height="8.5in" page-width="11in" master-name="only" margin=".5in .5in .5in .5in">
<fo:region-body region-name="xsl-region-body" margin-top="1in" margin-bottom=".5in"/>
<fo:region-before region-name="xsl-region-before"/>
<fo:region-after region-name="xsl-region-after"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="only">
<fo:static-content flow-name="xsl-region-before">
<fo:block font-size="7pt">
<fo:table width="10in">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:external-graphic src="img/print_logo.png" content-width="2in"/>
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center">
<fo:block text-align="right">
123 Credibility Street
</fo:block>
<fo:block text-align="right">
Chicago, IL 60606
</fo:block>
<fo:block text-align="right">
312-123-4567
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:static-content>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过将两个元素放入两个独立的块容器中并具有绝对定位来达到预期的效果:
I managed to achieve the desired effect by putting the two elements in two separate block-containers with absolute positioning:
虽然回复晚了,但询问必须得到答复。所以就是这样:
是的,这里需要绝对定位,但更重要的是你放置块容器的顺序。
最后一个容器中的内容将位于其他容器之上。
It's late to reply, but query must be answered. So here is it:
Yes, absolute positioning is required here, but more important is the sequence of block-container you place.
The contents with last container will be on top of others.