我有以下fop代碼生成顯示與2列和2行與一些數據的表。FOP表在RTL模式下顯示不正確
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<fo:layout-master-set>
<fo:simple-page-master writing-mode="rl-tb" master-name="pagesize" page-height="238.5pt" page-width="1020.78pt" margin-left="0pt" margin-right="0pt" margin-top="0pt" margin-bottom="0pt">
<fo:region-body margin-top="0pt" margin-bottom="0pt"/>
<fo:region-before extent="0pt"/>
<fo:region-after extent="0pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="pagesize">
<fo:flow flow-name="xsl-region-body">
<fo:block-container absolute-position="absolute" writing-mode="rl-tb" font-family="Liberation Sans" font-size="13.25pt" font-style="normal" font-weight="normal" top="20pt" right="20pt" width="1020.78pt" height="238.5pt" background-color="brown">
<fo:table wrap-option="no-wrap" overflow="hidden" border-collapse="separate" background-color="green">
<fo:table-column column-width="69.5625pt"/>
<fo:table-column column-width="69.5625pt"/>
<fo:table-body>
<fo:table-row background-color="#FFFFFF">
<fo:table-cell padding-right="2.48438pt" padding-left="2.48438pt" padding-top="0.49687pt" padding-bottom="0.49687pt" height="24.84375pt" relative-align="baseline" display-align="center" overflow="hidden">
<fo:block-container text-align="right" display-align="center" white-space-treatment="preserve" white-space-collapse="false" linefeed-treatment="preserve" overflow="hidden">
<fo:block/>
</fo:block-container>
</fo:table-cell>
<fo:table-cell padding-right="2.48438pt" padding-left="2.48438pt" padding-top="0.49687pt" padding-bottom="0.49687pt" height="24.84375pt" relative-align="baseline" display-align="center" overflow="hidden">
<fo:block-container text-align="center" display-align="center" white-space-treatment="preserve" white-space-collapse="false" linefeed-treatment="preserve" overflow="hidden">
<fo:block>Fiscal Calendar</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
<fo:table-row background-color="#FFFFFF">
<fo:table-cell padding-right="2.48438pt" padding-left="2.48438pt" padding-top="0.49687pt" padding-bottom="0.49687pt" height="24.84375pt" relative-align="baseline" display-align="center" overflow="hidden">
<fo:block-container text-align="right" display-align="center" white-space-treatment="preserve" white-space-collapse="false" linefeed-treatment="preserve" overflow="hidden">
<fo:block>Accounts</fo:block>
</fo:block-container>
</fo:table-cell>
<fo:table-cell padding-right="2.48438pt" padding-left="2.48438pt" padding-top="0.49687pt" padding-bottom="0.49687pt" height="24.84375pt" relative-align="baseline" display-align="center" overflow="hidden">
<fo:block-container text-align="right" display-align="center" white-space-treatment="preserve" white-space-collapse="false" linefeed-treatment="preserve" overflow="hidden">
<fo:block>#</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
問題:表格在rtl模式下不是右對齊,而是單元格中的內容是右對齊的,這是正確的。我檢查了輸出,並看到寫入模式適用於正確顯示文本的表格單元從右到左,但儘管給出了塊容器的右側和絕對位置屬性,但表格並沒有正確對齊。我試着給相同的屬性fo:表仍然沒有工作。
我檢查apache fop文檔,並且正確使用了屬性。讓我知道如果我失去了一些東西。
請發佈完整的XSL FO,當然,您的XSL FO不會以layout-master-set開頭並以root結尾。您錯過了我們診斷的整個頂部。 –
@KevinBrown OP不小心刪除了[之前的版本]中的'fo:root'元素(http://stackoverflow.com/posts/42560731/revisions#rev2717fb4d-c1ce-425d-8a49-e0de073466c7),我把它編輯回來了(不是那裏有什麼重要的) – lfurini
@KevinBrown ..當你診斷時,請檢查表格元素是否正確對齊而不是塊容器。如果,我將塊容器寬度設置爲等於表元素寬度,那麼您可以注意到該表正確對齊。我想知道爲什麼表格元素的right和position屬性沒有使它正確對齊。 – TheGaME