speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
296 stars 36 forks source link

Multiline table header (sometimes) starts table on next page #361

Closed grigorem closed 2 years ago

grigorem commented 2 years ago

I'm trying to use the publisher to create a table, but the content before is dynamic and I can't control where the table starts.

The problem is that sometimes it will start the table on the next page (with the table height calculated for the remaining of the previous page) when using a header that has more than one line.

Here is the layout.xml example (there is a commented paragraph which when uncommented will show the table behave as expected). I'm using areas for the header and footer and I suspect the issue to be related to the vertical spacing.

<Layout
    xmlns="urn:speedata.de:2009/publisher/en"
    xmlns:sd="urn:speedata:2009/publisher/functions/en">

    <DefineColor name="watermark" model="RGB" r="0" g="0" b="0" alpha="20"/>
    <DefineFontalias existing="CrimsonPro-Regular" alias="regular"/>
    <DefineFontfamily name="watermark" fontsize="150" leading="200">
        <Regular fontface="regular"/>
    </DefineFontfamily>

    <Pagetype name="default" test="true()">

      <Margin left="1cm" right="1cm" top="1cm" bottom="1cm"/>

      <PositioningArea name="header">
        <PositioningFrame width="{sd:number-of-columns()}" height="1.5" row="1" column="1"/>
      </PositioningArea>
      <PositioningArea name="main">
        <PositioningFrame width="{sd:number-of-columns()}" height="{sd:number-of-rows() - 6}" row="3" column="1"/>
      </PositioningArea>
      <PositioningArea name="footer">
        <PositioningFrame width="{sd:number-of-columns()}" height="4" row="{sd:number-of-rows() - 3}" column="1"/>
      </PositioningArea>
    </Pagetype>

    <Record element="data">
        <PlaceObject area="main">
          <Textblock>
            <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph>
            <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph>
            <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph>
            <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph>
            <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph>
            <!-- <<<<<<<<< Uncomment next paragraph to make it behave as expected >>>>>>>>> -->
             <!-- <Paragraph>
              <Value select="sd:dummytext()"/>
            </Paragraph> -->
          </Textblock>
        </PlaceObject>

        <PlaceObject area="main">
            <Table stretch="max" padding="5pt" leading="5pt">
              <Columns>
                <Column width="1*" align="center" valign="middle"/>
              </Columns>
              <Tablehead>
                <Tr>
                  <Td valign="bottom">
                    <Paragraph>
                      <Value>
                        Table
                        column
                      </Value>
                    </Paragraph>
                  </Td>
                </Tr>
              </Tablehead>
              <Loop select="50">
                <Tr>
                  <Td>
                    <Paragraph>
                      <Value>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</Value>
                    </Paragraph>
                  </Td>
                </Tr>
                <Tablerule rulewidth="1pt" color="grey" />
              </Loop>
            </Table>
          </PlaceObject>
    </Record>
</Layout>
image
pgundlach commented 2 years ago

This looks like a bug. Thank you for the report.

pgundlach commented 2 years ago

Fixed in 4.7.10. Thanks again for the report! Very helpful.