Hi Andreas, Andreas L Delmelle a écrit : > On Dec 24, 2006, at 09:53, Andreas L Delmelle wrote: > > <snip /> >> Just had another look, and it currently only works correctly in case >> there is no column-spanning going on in any of the cells in the first >> row. >> >> <fo:table> >> <fo:table-body> >> <fo:table-cell width="2in" number-columns-spanned="2"> >> ... >> >> In this case, two implicit columns are created, but the cell's width >> is not yet distributed over the two columns. >> >> I'll add a testcase demonstrating what still goes wrong, but the issue >> probably needs to put in a slightly different wording, indicating that >> it works apart from the above reservation.
I'm curious about your testcase, actually, because after quick testing I haven't been able to reproduce it (attached fo file, first table, works fine). > In the meantime, I've locally patched FOP to correctly deal with this. > > Patch consists of a few changes in TableBody, TableRow and > PercentLength. The latter only because I needed to have some way to be > able to get the percentage value of the cell-width, divide it by the > number of columns spanned, and construct a new PercentLength with the > percentage distributed over the number of columns. > > Full patch below. No objection, some code was obviously lacking at that place, anyway (nothing done when colspan != 1). That made me think of the testcase showed in the second table in the attached file. There is a colspan on the first row, which sets the width of the first two columns. But we might want to refine that on the second row, by specifying a different width for each column individually. That testcase fails... WDYT? <snip/> Vincent
<?xml version="1.0" standalone="no"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="page" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="3cm" margin-right="3cm"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="page" font-family="serif" font-size="14pt"> <fo:flow flow-name="xsl-region-body"> <fo:table padding="10pt" width="7.5cm" table-layout="fixed" border-collapse="separate" border-separation="4pt" border="4pt solid black"> <fo:table-body> <fo:table-row> <fo:table-cell border="4pt solid red" width="5cm" number-columns-spanned="2"> <fo:block>Cell 1</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid red"> <fo:block>Cell 2</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell border="4pt solid green"> <fo:block>Cell 3</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid green"> <fo:block>Cell 4</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid green"> <fo:block>Cell 5</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> <fo:table padding="10pt" width="7.5cm" table-layout="fixed" border-collapse="separate" border-separation="4pt" border="4pt solid black" space-before="10pt"> <fo:table-body> <fo:table-row> <fo:table-cell border="4pt solid red" width="5cm" number-columns-spanned="2"> <fo:block>Cell 1</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid red"> <fo:block>Cell 2</fo:block> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell border="4pt solid green" width="3.5cm"> <fo:block>Cell 3</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid green" width="1.5cm"> <fo:block>Cell 4</fo:block> </fo:table-cell> <fo:table-cell border="4pt solid green"> <fo:block>Cell 5</fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:flow> </fo:page-sequence> </fo:root>
