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 "Winterflood, Jonathan" <jo...@capgemini.com> on 2007/09/12 10:22:51 UTC

Full-page table, %-height rows, and block-progression-dimension

Hi list,

I'm trying to find a way to set the height of a table, and set the
row-height to a percentage of that, but I can't seem to get it to
work...

The specific problems are:
# Filling a page with a table, setting the height of some of the
elements, and letting the last one fill the space:
+------+
|      | Content-based (1/2 lines of text)
+------+
|      |
|      |   Leftover space
+------+
|      | 5cm
+------+


# Having 3 lines of the same size, regardless of content, and based on
the height of a multi-line cell:

+---+---+
|33%| g |
|   | r |
+---+ a |
|33%| p |
|   | h |
+---+ i |
|33%| c |
|   | ! |
+---+---+

A asked on the w3.org xsl-fo list, and it was suggested I put the table
in a <fo:block-container> with a block-progression-dimension of the
desired height (ie that of the graphic, or page)

This apparently works with XEP, but not in FOP. Is there a trick that
would allow this in FOP?

I'm currently using v0.94


Thanks in advance,

Jonathan Winterflood
jonathan.winteflood@capgemini.com



This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi Chris,

Chris Bowditch a écrit :
> Vincent Hennebert wrote:
> 
> Hi Vincent,
> 
>>
>> Just a few notes about heights in tables as I worked on this a few
>> months ago.
>> The XSL-FO Recommendation refers to CSS2 [1] for a description of how
>> heights in tables should be handled. And CSS2 explicitely does not
>> specify [2] how heights should be handled when they have an explicit
>> value. More precisely:
>> - when specified on an fo:table, whether the height of the table’s  
>> content should override that value, or how possible remaining space  
>> should be distributed;
>> - for fo:table-row and fo:table-cell, what percentage values of
>> `height’   should refer to.
>>
>> Thus, for now explicit values of `height’ on table, table-row,
>> table-cell are discarded and replaced by `auto’ (I think a warning
>> should appear in such cases). In the future we might decide on a
>> certain behaviour, but in any case this would be FOP-specific and non
>> standard. Perhaps the other renderers have a common reasonable
>> behaviour, I haven’t looked. We will see when we decide to tackle this
>> issue, but I’m afraid it may not be of high priority...
> 
> I agree with most of what you said. Except in the case when there is a
> explicit (not %) height on a table-row. If the content of the row is
> less than the specified height then the row should be stretched to match
> the specified height, with extra space added at the end. FOP-0.20.5 used
> to support this. As do other XSL-FO implementations. I'm not an expert
> with the spec but you didn't mention this case in your e-mail. WDYT?

Indeed, that case is specified by CSS2 to behave like you explained; 
although for extra-space, this depends on the display-align set on the 
cell. In fact cells have their heights extended to the row’s height and 
extra space is put as additional padding at the top or the bottom of the 
cell. If I understand correctly...

Vincent

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


Re: [?? Probable Spam] Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Chris Bowditch <bo...@hotmail.com>.
Vincent Hennebert wrote:

Hi Vincent,

> 
> Just a few notes about heights in tables as I worked on this a few 
> months ago.
> The XSL-FO Recommendation refers to CSS2 [1] for a description of how 
> heights in tables should be handled. And CSS2 explicitely does not 
> specify [2] how heights should be handled when they have an explicit 
> value. More precisely:
> - when specified on an fo:table, whether the height of the table’s 
>   content should override that value, or how possible remaining space 
>   should be distributed;
> - for fo:table-row and fo:table-cell, what percentage values of `height’ 
>   should refer to.
> 
> Thus, for now explicit values of `height’ on table, table-row, 
> table-cell are discarded and replaced by `auto’ (I think a warning 
> should appear in such cases). In the future we might decide on a certain 
> behaviour, but in any case this would be FOP-specific and non standard. 
> Perhaps the other renderers have a common reasonable behaviour, 
> I haven’t looked. We will see when we decide to tackle this issue, but 
> I’m afraid it may not be of high priority...

I agree with most of what you said. Except in the case when there is a 
explicit (not %) height on a table-row. If the content of the row is 
less than the specified height then the row should be stretched to match 
the specified height, with extra space added at the end. FOP-0.20.5 used 
to support this. As do other XSL-FO implementations. I'm not an expert 
with the spec but you didn't mention this case in your e-mail. WDYT?

Thanks,

Chris



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


Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi,

Winterflood, Jonathan a écrit :
> Hi list,
> 
> I'm trying to find a way to set the height of a table, and set the
> row-height to a percentage of that, but I can't seem to get it to
> work...

Just a few notes about heights in tables as I worked on this a few 
months ago.
The XSL-FO Recommendation refers to CSS2 [1] for a description of how 
heights in tables should be handled. And CSS2 explicitely does not 
specify [2] how heights should be handled when they have an explicit 
value. More precisely:
- when specified on an fo:table, whether the height of the table’s 
  content should override that value, or how possible remaining space 
  should be distributed;
- for fo:table-row and fo:table-cell, what percentage values of `height’ 
  should refer to.

Thus, for now explicit values of `height’ on table, table-row, 
table-cell are discarded and replaced by `auto’ (I think a warning 
should appear in such cases). In the future we might decide on a certain 
behaviour, but in any case this would be FOP-specific and non standard. 
Perhaps the other renderers have a common reasonable behaviour, 
I haven’t looked. We will see when we decide to tackle this issue, but 
I’m afraid it may not be of high priority...

HTH,
Vincent

[1] http://www.w3.org/TR/xsl11/#height
[2] http://www.w3.org/TR/REC-CSS2/tables.html#height-layout

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


Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 21, 2007, at 09:22, Winterflood, Jonathan wrote:

>
> Ok, I'll see what I can do with them if I switch :)

FWIW: instead of percentages, you could also resort to the XSL-FO  
core functions to compute the height based on an ancestor:

<fo:root text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/ 
Format">
   <fo:layout-master-set>
     <fo:simple-page-master master-name="A4_1" margin="1cm" page- 
width="21cm" page-height="29.7cm">
       <fo:region-body/>
     </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="A4_1">
     <fo:flow flow-name="xsl-region-body">
       <fo:block-container height="100%">
         <fo:block-container height="from-nearest-specified-value()  
div 2">
           <fo:block>test1</fo:block>
         </fo:block-container>
         <fo:block-container height="from-nearest-specified-value()  
div 2">
           <fo:block>test2</fo:block>
         </fo:block-container>
       </fo:block-container>
     </fo:flow>
   </fo:page-sequence>
</fo:root>

As you see, one percentage and two function-calls avoid absolute  
numerics, so the code will work on whatever simple-page-master it is  
rendered on.


Cheers

Andreas

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


RE: Full-page table, %-height rows, and block-progression-dimension

Posted by "Winterflood, Jonathan" <jo...@capgemini.com>.
Ok, I'll see what I can do with them if I switch :)

Thanks a lot,
Jonathan

-----Message d'origine-----
De : Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Envoyé : mardi 18 septembre 2007 23:29
À : fop-users@xmlgraphics.apache.org
Objet : Re: Full-page table, %-height rows, and block-progression-dimension

On Sep 18, 2007, at 10:58, Winterflood, Jonathan wrote:

Hi

> Here is my test code for 2 rows, 50%, 25cm:
<snip />

Thanks for the sample.

> FOP complains about this (many times):
>
> 18 sept. 2007 09:54:37  
> org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
> GRAVE: Cannot find LM to handle given FO for LengthBase. (fo:table- 
> row, location: 13/49)

Yep, as I remember exactly, only I saw it last in trying to get  
percentage cell-widths in the first row correctly distributed over  
implicit columns.

>
> I understand why the percentages are vaguely defined in CSS, hence  
> the block-progression 'workaround' in XEP
> I imagine FOP simply does not define what to do with percentages,  
> though.

Currently not, I'm afraid. Percentage-heights do work well on  
fo:block-containers, though.

See:

<fo:root text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/ 
Format">
   <fo:layout-master-set>
     <fo:simple-page-master master-name="A4_1" margin="1cm" page- 
width="21cm" page-height="29.7cm">
       <fo:region-body/>
     </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="A4_1">
     <fo:flow flow-name="xsl-region-body">
       <fo:block-container height="50%">
         <fo:block>test1</fo:block>
       </fo:block-container>
       <fo:block-container height="50%">
         <fo:block>test2</fo:block>
       </fo:block-container>
     </fo:flow>
   </fo:page-sequence>
</fo:root>

Getting two of them next to each other would require absolute- 
positioning, but AFAICT, percentages are not yet correctly  
implemented for top/left/bottom/right...

HTH!

Andreas


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


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 18, 2007, at 10:58, Winterflood, Jonathan wrote:

Hi

> Here is my test code for 2 rows, 50%, 25cm:
<snip />

Thanks for the sample.

> FOP complains about this (many times):
>
> 18 sept. 2007 09:54:37  
> org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
> GRAVE: Cannot find LM to handle given FO for LengthBase. (fo:table- 
> row, location: 13/49)

Yep, as I remember exactly, only I saw it last in trying to get  
percentage cell-widths in the first row correctly distributed over  
implicit columns.

>
> I understand why the percentages are vaguely defined in CSS, hence  
> the block-progression 'workaround' in XEP
> I imagine FOP simply does not define what to do with percentages,  
> though.

Currently not, I'm afraid. Percentage-heights do work well on  
fo:block-containers, though.

See:

<fo:root text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/ 
Format">
   <fo:layout-master-set>
     <fo:simple-page-master master-name="A4_1" margin="1cm" page- 
width="21cm" page-height="29.7cm">
       <fo:region-body/>
     </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="A4_1">
     <fo:flow flow-name="xsl-region-body">
       <fo:block-container height="50%">
         <fo:block>test1</fo:block>
       </fo:block-container>
       <fo:block-container height="50%">
         <fo:block>test2</fo:block>
       </fo:block-container>
     </fo:flow>
   </fo:page-sequence>
</fo:root>

Getting two of them next to each other would require absolute- 
positioning, but AFAICT, percentages are not yet correctly  
implemented for top/left/bottom/right...

HTH!

Andreas


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


RE: Full-page table, %-height rows, and block-progression-dimension

Posted by "Winterflood, Jonathan" <jo...@capgemini.com>.
Hi,

Here is my test code for 2 rows, 50%, 25cm:

<fo:root text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="A4_1" margin="1cm" page-width="21cm" page-height="29.7cm">
   <fo:region-body/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="A4_1">
  <fo:flow flow-name="xsl-region-body">
   <fo:block-container block-progression-dimension="25cm">
    <fo:table table-layout="fixed" width="100%">
     <fo:table-body>
      <fo:table-row height="50%" border="solid">
       <fo:table-cell>
        <fo:block>test1</fo:block>
       </fo:table-cell>
      </fo:table-row>
      <fo:table-row height="50%" border="solid">
       <fo:table-cell>
        <fo:block>test2</fo:block>
       </fo:table-cell></fo:table-row></fo:table-body></fo:table>
</fo:block-container></fo:flow></fo:page-sequence>
</fo:root>

FOP complains about this (many times):

18 sept. 2007 09:54:37 org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
GRAVE: Cannot find LM to handle given FO for LengthBase. (fo:table-row, location: 13/49)

I understand why the percentages are vaguely defined in CSS, hence the block-progression 'workaround' in XEP
I imagine FOP simply does not define what to do with percentages, though.

I have worked around the problem for now by setting the individual heights.

Indeed, absolute-positioning of block-containers with some xpath magic could be an alternative as there are only a few rows/columns. 


Thanks for your help,
Jonathan

-----Message d'origine-----
De : Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Envoyé : samedi 15 septembre 2007 15:02
À : fop-users@xmlgraphics.apache.org
Objet : Re: Full-page table, %-height rows, and block-progression-dimension

On Sep 12, 2007, at 10:22, Winterflood, Jonathan wrote:

Hi

> Hi list,
>
> I'm trying to find a way to set the height of a table, and set the
> row-height to a percentage of that, but I can't seem to get it to
> work...
>

I think I understand the issue, but to make sure:
Could you perhaps post a small fragment that reflects what you have  
tried (don't need the whole table; if you can just draft the FO-code  
for the block-container, the table and its first row, that would be  
enough)?

I seem to remember that percentages in tables (for row-height and  
column-width) currently don't work at all. CSS and XSL-FO remain  
quite vague in their definition of how percentages should be  
interpreted here. CSS even states explicitly that the behavior of  
percentages in tables remains undefined (most likely because it leads  
to all sorts of vicious circles in HTML --read: non-paginated  
layout-- where the 33% would be roughly a third of the containing  
HTML-page's height, which *includes* the row on which the percentage  
is specified).

Depending on the complexity of the table in question, you may want to  
consider switching to block-containers entirely (instead of a table,  
use absolute-positioned block-containers that correspond to what are  
the cells in your current situation).
Mind that this would not be feasible for a 20-column x 100-row  
layout, but if the numbers are 2-column x 3-rows, then using a table  
could prove to be overkill.


Cheers

Andreas

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


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Full-page table, %-height rows, and block-progression-dimension

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 12, 2007, at 10:22, Winterflood, Jonathan wrote:

Hi

> Hi list,
>
> I'm trying to find a way to set the height of a table, and set the
> row-height to a percentage of that, but I can't seem to get it to
> work...
>

I think I understand the issue, but to make sure:
Could you perhaps post a small fragment that reflects what you have  
tried (don't need the whole table; if you can just draft the FO-code  
for the block-container, the table and its first row, that would be  
enough)?

I seem to remember that percentages in tables (for row-height and  
column-width) currently don't work at all. CSS and XSL-FO remain  
quite vague in their definition of how percentages should be  
interpreted here. CSS even states explicitly that the behavior of  
percentages in tables remains undefined (most likely because it leads  
to all sorts of vicious circles in HTML --read: non-paginated  
layout-- where the 33% would be roughly a third of the containing  
HTML-page's height, which *includes* the row on which the percentage  
is specified).

Depending on the complexity of the table in question, you may want to  
consider switching to block-containers entirely (instead of a table,  
use absolute-positioned block-containers that correspond to what are  
the cells in your current situation).
Mind that this would not be feasible for a 20-column x 100-row  
layout, but if the numbers are 2-column x 3-rows, then using a table  
could prove to be overkill.


Cheers

Andreas

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