You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Roland Schroth <rs...@albit.de> on 2003/11/13 09:07:59 UTC

image in table header overlapping table body <-- possible ?

Hello, out there ;-)

I need to build a table with a header line containing an image and a single
line of text. The problem is the image beeing to high to fit into the header
line which causes the header line to be resized vertically to match the
height of the image.

But i need the image to overflow the bottom of the header line (leaving its
height unchanged) so that it flows right into the body area. The problem is
that the overflow property isn't supported yet and a number-rows-spanned
does not seem to work here because header and body rows obviously cannot be
mixed.


I try to draw what i want to get (view with fixed-width font):



xsl-fo-area   /      in PDF it should look like that
______________/________________________________________________
              /
              /
----          /      +---------+
table-header  /      |         |   Some header text ...
----          /      | header- |
              /      |  image  |   first row of table-body
              /      |         |   second row of table-body
table-body    /      +---------+   third row of table-body
              /                      .
              /                      .
              /                      .
              /                      .
----          /


(i hope that makes my problem clear)


As i generate the fo code and the PDF at runtime from different data in a
database, there may occur page breaks cutting the table into several pieces
and the header absolutely has to appear above each piece.
I also tried to use position="relative" with the top and left properties set
but did not get it working although i am sure this should work with the
actual version. Mabe i just don't see the forest for the trees ...

Does anyone have an idea of how to achieve this?
I would really appreciate any hint.

Thanks in advance,
Roland



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ?

Posted by Roland Neilands <rn...@pulsemining.com.au>.
> > Use nested tables:
> Only problem I still see is how's he going to make the contents of the
> table-body flow alongside the image in the header.

It's a separate table with a separate header. Try it & see ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ?

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Roland Neilands [mailto:rneilands@pulsemining.com.au]
>
> Roland,
>
> Use nested tables:
>

Cool! There goes my attempt ... :)

Only problem I still see is how's he going to make the contents of the
table-body flow alongside the image in the header.


Greetz,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ?

Posted by Roland Neilands <rn...@pulsemining.com.au>.
Roland,

Use nested tables:

<fo:table table-omit-header-at-break="false">
  <fo:table-column column-width="3cm"/>
  <fo:table-column column-width="17cm"/>
  <fo:table-header>
    <fo:table-row>
      <fo:table-cell>
        <fo:block> <!-- Your image here --> </fo:block>
      </fo:table-cell>
      <fo:table-cell />
    </fo:table-row>
  </fo:table-header>
  <fo:table-body>
    <fo:table-row>
      <fo:table-cell />
      <fo:table-cell>
      
        <!-- Your current table (text only) --> 
        <fo:table table-omit-header-at-break="false">
           ...
        </fo:table>
      
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>

Cheers,
Roland

> I need to build a table with a header line containing an image and a single
> line of text. The problem is the image beeing to high to fit into the header
> line which causes the header line to be resized vertically to match the
> height of the image.
> 
> But i need the image to overflow the bottom of the header line (leaving its
> height unchanged) so that it flows right into the body area. The problem is
> that the overflow property isn't supported yet and a number-rows-spanned
> does not seem to work here because header and body rows obviously cannot be
> mixed.
> 
> 
> I try to draw what i want to get (view with fixed-width font):
> 
> 
> 
> xsl-fo-area   /      in PDF it should look like that
> ______________/________________________________________________
>               /
>               /
> ----          /      +---------+
> table-header  /      |         |   Some header text ...
> ----          /      | header- |
>               /      |  image  |   first row of table-body
>               /      |         |   second row of table-body
> table-body    /      +---------+   third row of table-body
>               /                      .
>               /                      .
>               /                      .
>               /                      .
> ----          /
> 
> 
> (i hope that makes my problem clear)
> 
> 
> As i generate the fo code and the PDF at runtime from different data in a
> database, there may occur page breaks cutting the table into several pieces
> and the header absolutely has to appear above each piece.
> I also tried to use position="relative" with the top and left properties set
> but did not get it working although i am sure this should work with the
> actual version. Mabe i just don't see the forest for the trees ...
> 
> Does anyone have an idea of how to achieve this?
> I would really appreciate any hint.
> 
> Thanks in advance,
> Roland
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: image in table header overlapping table body <-- possible ? [additional info]

Posted by Roland Schroth <rs...@albit.de>.
> > > -----Original Message-----
> > > From: Roland Neilands [mailto:rneilands@pulsemining.com.au]
> > >
> > > Roland,
> > >
> > > Use nested tables:
> >
> > That is what i tried yesterday, too. Thanks anyway.
> > It's a solution to get the image in the first header of the table. But i
> > still end up with the problem having it repeated after a page break.
>
> Aaah... you *don't* need the image repeated across pages.

Ooops ... no sorry. One of these situations, my lack of practice with the
english language shows up.

    I  *absolutely need*  it to be repeated.

Thanks again,
Roland



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ? [additional info]

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Roland Schroth [mailto:rs@albit.de]
>
>
> > -----Original Message-----
> > From: Roland Neilands [mailto:rneilands@pulsemining.com.au]
> >
> > Roland,
> >
> > Use nested tables:
>
> That is what i tried yesterday, too. Thanks anyway.
> It's a solution to get the image in the first header of the table. But i
> still end up with the problem having it repeated after a page break.

Aaah... you *don't* need the image repeated across pages.

> The text header will be repeated as there is data in its table-body being
> continued after the page break. But there is no data in the
> table-body that

So, the image would actually belong to the table-body, and only the text
belongs to table-header (? correct?).
In that case my proposal could work, if it were not for the complication
described below.

> There occur line breaks in the rows (mostly generated within FOP caused by
> hyphenation), that i cannot calculate that easy. Therefore i cannot set a
> fixed row height and i do not know how many rows there will be on
> a page. I
> tried to calculate these linebreaks according to the amount of text in the
> fields but that's quite dirty (and not completely functioning at all ...)
>

Very dirty indeed... Imagine having to deal with a situation like this and
having to base your calculations on the metrics of the particular font being
used. (for fixed-width fonts this would be a bit less complicated since you
can just take the number of chars and multiply that by the charwidth).

> I think i will try to get some other things working first and come back to
> this one next week. Sometimes a weekend of doing nothing helps more than
> days of thinking ;-)
>

Very wise indeed!

Cheerz,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ? [additional info]

Posted by Roland Neilands <rn...@pulsemining.com.au>.
> > Use nested tables:
> 
> That is what i tried yesterday, too. Thanks anyway.
> It's a solution to get the image in the first header of the table. But i
> still end up with the problem having it repeated after a page break.
> The text header will be repeated as there is data in its table-body being
> continued after the page break. But there is no data in the table-body that
> belongs to the image header so there is no reason for FOP to repeat the
> header (the image) on the next page.

So put a single cell in the body beneath the image.
Put a blank image or a non-breaking space(&#160;) in it to force it to appear.

Cheers,
Roland 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: image in table header overlapping table body <-- possible ? [additional info]

Posted by Roland Schroth <rs...@albit.de>.
> -----Original Message-----
> From: Roland Neilands [mailto:rneilands@pulsemining.com.au]
>
> Roland,
>
> Use nested tables:

That is what i tried yesterday, too. Thanks anyway.
It's a solution to get the image in the first header of the table. But i
still end up with the problem having it repeated after a page break.
The text header will be repeated as there is data in its table-body being
continued after the page break. But there is no data in the table-body that
belongs to the image header so there is no reason for FOP to repeat the
header (the image) on the next page.
And with this problem in mind i come to the idea of Andreas.

> ----- Original Message ----- 
> From: "Andreas L. Delmelle" <a_...@pandora.be>


> I see a remote possiblity in performing some XSL trickery (resting on the
> assumption that the rows in the table body are generated by XML elements).
> If you define a row height globally in your stylesheet, as well as the
> region-body height... You know in advance how many rows will fit on a
> page... ( $regbh div $rowh ).

And here we have my next problem ...
There occur line breaks in the rows (mostly generated within FOP caused by
hyphenation), that i cannot calculate that easy. Therefore i cannot set a
fixed row height and i do not know how many rows there will be on a page. I
tried to calculate these linebreaks according to the amount of text in the
fields but that's quite dirty (and not completely functioning at all ...)

> For the moment, however, it's the closest thing to a solution I can come
up
> with...

I agree.

I think i will try to get some other things working first and come back to
this one next week. Sometimes a weekend of doing nothing helps more than
days of thinking ;-)

Thanks to both of you and have a nice weekend,
Roland



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ? [additional info]

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Roland Schroth [mailto:rs@albit.de]
>
> I think your idea could work if i had only one table starting at
> the top of
> the page.
>

The mistake was mine... Didn't study the drawing closely enough to see that
it was about *table* headers. Sorry 'bout that.

>    But (sorry that i did not mention that) i have a sequence of tables of
>    different lengths that therefore also may start in the middle
> of a page.
>    There are tables being only a few rows long an others spanning 2 or 3
>    pages. So i need something that will work for that case too.
>

A very tough one...

I see a remote possiblity in performing some XSL trickery (resting on the
assumption that the rows in the table body are generated by XML elements).
If you define a row height globally in your stylesheet, as well as the
region-body height... You know in advance how many rows will fit on a
page... ( $regbh div $rowh ).
Then, for each set of XML elements (corresponding to a table) you know in
advance how many rows will be generated (counting the nodes). You also know
that the first element of the set/table will generate an additional row to
accomodate the header-text & the image --first cell has a rowspan of 4 - so
if a table starts at the top of the page, you will be able to put ( ( $regbh
div $rowh ) - 1 ) of the XML elements (rows) on the same page.
If the table starts in the middle of a page and each table is being
generated by a template, maybe the maximum possible number of rows that can
still fit on the 'page' can be passed in as a parameter...
(Keep in mind that this is all pure calculation, as there is no concept of a
page-layout at the XSLT stage.)

Then again... having to keep count of the elements and inserting a 'fake'
header at every expected page-break is hardly an ideal situation. (Not to
mention that it will lead to trouble if somehow the page-break doesn't end
up where expected)

For the moment, however, it's the closest thing to a solution I can come up
with...

Anyone?


Cheerz,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: image in table header overlapping table body <-- possible ? [additional info]

Posted by Roland Schroth <rs...@albit.de>.
I think your idea could work if i had only one table starting at the top of
the page.

   But (sorry that i did not mention that) i have a sequence of tables of
   different lengths that therefore also may start in the middle of a page.
   There are tables being only a few rows long an others spanning 2 or 3
   pages. So i need something that will work for that case too.

Anyway, thanks for your quick response.

Roland

> > But i need the image to overflow the bottom of the header line
> > (leaving its
> > height unchanged) so that it flows right into the body area. The
> > problem is
> > that the overflow property isn't supported yet and a number-rows-spanned
> > does not seem to work here because header and body rows obviously
> > cannot be
> > mixed.
> >
>
> Try the following (for example):
>
> in the simple-page-master, set the margin-top for the region body to the
> height of the one line containing 'Some Header Text' --depending on the
> font-size of the text, of course.
> Then set the height of the region-before to be greater than the margin-top
> just defined (roughly equivalent to the height of the image).
>
> This way your region-before will actually overlap the region-body by
> (region-body-margin-top - region-before-height).
>
> (This trick has often been advised as a workaround for adding watermarks,
so
> I guess the result would be that the header-image actually ends up being
> overwritten by the content of the region-body --if any... So if you make
> sure the first rows have no content at all in the first columns, this
should
> actually work.)



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: image in table header overlapping table body <-- possible ?

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Roland Schroth
>
> But i need the image to overflow the bottom of the header line
> (leaving its
> height unchanged) so that it flows right into the body area. The
> problem is
> that the overflow property isn't supported yet and a number-rows-spanned
> does not seem to work here because header and body rows obviously
> cannot be
> mixed.
>

Try the following (for example):

in the simple-page-master, set the margin-top for the region body to the
height of the one line containing 'Some Header Text' --depending on the
font-size of the text, of course.
Then set the height of the region-before to be greater than the margin-top
just defined (roughly equivalent to the height of the image).

This way your region-before will actually overlap the region-body by
(region-body-margin-top - region-before-height).

(This trick has often been advised as a workaround for adding watermarks, so
I guess the result would be that the header-image actually ends up being
overwritten by the content of the region-body --if any... So if you make
sure the first rows have no content at all in the first columns, this should
actually work.)


Hope this helps!

Greetz,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org