如何覆盖 "region-body" 为 XSL:FO 中的 table 设置的边距?
how can I override a margin set by "region-body" for a table in XSL:FO?
我正在编辑 XSL 文档,该文档在将 XML 转换为 PDF 时控制输出格式。使用“fo:region-body”标记的页面布局中存在现有的左边距。布局设置为“fo:page-sequence”元素中的主参考,其中包含我的 table 的流程和块。我希望我的 table 覆盖边距。我尝试在 table 上使用负边距(我在“table”和“table-body”上都尝试过,但只有 table 内容向左移动. table 边界保持在同一个地方。
有人能给我指出正确的方向吗?
您可能需要包围结构并在其上设置边距。这是一个例子:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
font-family="Helvetica" font-size="11pt">
<fo:layout-master-set>
<fo:simple-page-master margin-top=".5in" margin-left="1in" margin-bottom="1in"
margin-right="1in" page-width="8.5in" page-height="11in" master-name="first">
<fo:region-body margin-top="0pt" margin-bottom="0pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>Table not in left margin space</fo:block>
<fo:block>
<fo:table width="100%">
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-top="1pt solid black" border-bottom="1pt solid red" border-left="1pt solid green" border-right="1pt solid orange" text-align="center">
<fo:block> Center Me </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>Table in left margin space</fo:block>
<fo:block margin-left="-0.75in">
<fo:table width="100%">
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-top="1pt solid black" border-bottom="1pt solid red" border-left="1pt solid green" border-right="1pt solid orange" text-align="center">
<fo:block> Center Me </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
结果如下:
我正在编辑 XSL 文档,该文档在将 XML 转换为 PDF 时控制输出格式。使用“fo:region-body”标记的页面布局中存在现有的左边距。布局设置为“fo:page-sequence”元素中的主参考,其中包含我的 table 的流程和块。我希望我的 table 覆盖边距。我尝试在 table 上使用负边距(我在“table”和“table-body”上都尝试过,但只有 table 内容向左移动. table 边界保持在同一个地方。
有人能给我指出正确的方向吗?
您可能需要包围结构并在其上设置边距。这是一个例子:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
font-family="Helvetica" font-size="11pt">
<fo:layout-master-set>
<fo:simple-page-master margin-top=".5in" margin-left="1in" margin-bottom="1in"
margin-right="1in" page-width="8.5in" page-height="11in" master-name="first">
<fo:region-body margin-top="0pt" margin-bottom="0pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block>Table not in left margin space</fo:block>
<fo:block>
<fo:table width="100%">
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-top="1pt solid black" border-bottom="1pt solid red" border-left="1pt solid green" border-right="1pt solid orange" text-align="center">
<fo:block> Center Me </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>Table in left margin space</fo:block>
<fo:block margin-left="-0.75in">
<fo:table width="100%">
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-top="1pt solid black" border-bottom="1pt solid red" border-left="1pt solid green" border-right="1pt solid orange" text-align="center">
<fo:block> Center Me </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
结果如下: