0
votes

I am editing an XSL document that controls the output format when converting an XML to a PDF. There is an existing left margin in the page layout using "fo:region-body" tag. The layout is set as a master-reference in a "fo:page-sequence" element, which contains the flow and block for my table. I would like my table to override the margin. I tried using a negative margin on the table (I tried it on both "table" and "table-body", but only the table content shifted to the left. The table border remained in the same place.

Could someone point me to the right direction?

1
You should post a short sample XSL FO for others to assist. That said, you could probably put the structure in a block/block-container and set padding/margin on that and not the table.Kevin Brown

1 Answers

1
votes

Likely you need to surround the structure and set the margin on that. Here is an example:

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

This results in the following:

enter image description here