TheGaME
TheGaME

Reputation: 453

Fop table not displayed correctly in rtl mode

I have the following fop code generated for displaying a table with 2 column and 2 row with some data.

<?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>

Problem: Table not right aligned in rtl mode but the contents within the cells are right aligned which is correct by the way. I checked the output, and see that writting-mode is applied to the table cells correctly displaying text right to left but the table as such is not right aligned despite giving right and absolute-position attribute to the block-container. I tried giving the same attributes to fo:table still it did not work.

I check the apache fop docs and I have used the attributes correctly. Let me know if I am missing something.

please check below Image for output generated by the above code. RTL Image

Upvotes: 1

Views: 552

Answers (1)

Kevin Brown
Kevin Brown

Reputation: 8877

While this is not an answer, it could be. Tested with RenderX, output is this:

enter image description here

Which if this is what you expect, you should file a bug report with FOP. The table should be built right to left.

Upvotes: 1

Related Questions