How to align table to the bottom of a page in XSL FO

淺唱寂寞╮ 提交于 2019-12-11 08:38:46

问题


I have a problem with absolute positioning in XSL FO. When creating a document I have to add a table to the bottom of a page. The problem is that the height of the table is not known. The following example shows my effort, but still the table is aligned to the top of the page.

<fo:block-container 
    bottom="1cm" 
    left="0" 
    width="100%" 
    height="auto" 
    position="absolute">
 <fo:table 
    border="0.5pt solid black" 
    border-collapse="collapse" 
    text-align="left" 
    table-layout="fixed" 
    width="100%" 
    background-color="white" 
    font-size="7pt">
  <fo:table-column column-width="60%"/>
  <fo:table-column column-width="40%"/>
  <fo:table-body>
    <fo:table-row border="0.5pt solid black">
      <fo:table-cell 
          border="inherit"  
          display-align="center"  
          padding="1pt" 
          padding-left="2pt">
        <fo:block>abcde</fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row border="0.5pt solid black">
      <fo:table-cell 
          border="inherit"  
          display-align="center"  
          padding="1pt" 
          padding-left="2pt">
        <fo:block>abcde</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>
</fo:block-container>

So the question is: Is there any solution how to align table to bottom of the page without knowing the height of the table?

I tried also to put the table in a footer, but if I don't know the hieght, I can't set the extent of the region-after.

Note: I have a block-container that has the same width and height as the page. The code above is in this container.

Note 2: I use fop 1.1


回答1:


Throw it into a footnote. That grows up from the bottom of the body region to an arbitrary height. I tell my students this technique is useful for things like disclaimers at the bottom of the last page of a legal document. No block containers are needed; no measurements needed.



来源:https://stackoverflow.com/questions/18019043/how-to-align-table-to-the-bottom-of-a-page-in-xsl-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!