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 Gregor Fellenz <gf...@gmx.net> on 2006/06/08 20:11:25 UTC

border-collapse workaround fop0.92beta

hi all,

i'm using fop0.92beta to realise a fo project with a table over several pages. the table layout with fop0.20.5 was pretty ok, but in this version i couldn't use the keep attributes. with 0.92 i got the keep attributes but i also need the same border-with across the whole table.

now i'm stuck with the table border implementation. i've learned in the archives that the border-collapse model isn't implemented yet. is there any workaround to achieve the 0.20.5 behaviour?

i came across the idea to put different values in every cell to get the same line width in the whole table... but before trying to implement this in my xslt i just want to ask if anyone has a better idea.


thanks,
gregor
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

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


Re: border-collapse workaround fop0.92beta

Posted by Martin Zak <ma...@gingerall.com>.
Hi,
I met the same issue, where borders was sometimes "doubled" in a table 
(where two elements had adjacent borders specified).
I came across with following workaround:
- border-left and border-bottom on <fo:table-cell> elements
- border-top and border-right on <fo:table> element
It came out as a nice (one line) border in whole table with no visible 
defects...
Cheers
Martin


Gregor Fellenz wrote:
> hi all,
>
> i'm using fop0.92beta to realise a fo project with a table over several pages. the table layout with fop0.20.5 was pretty ok, but in this version i couldn't use the keep attributes. with 0.92 i got the keep attributes but i also need the same border-with across the whole table.
>
> now i'm stuck with the table border implementation. i've learned in the archives that the border-collapse model isn't implemented yet. is there any workaround to achieve the 0.20.5 behaviour?
>
> i came across the idea to put different values in every cell to get the same line width in the whole table... but before trying to implement this in my xslt i just want to ask if anyone has a better idea.
>
>
> thanks,
> gregor
>   

-- 
Martin Zak
project manager, developer

Ginger Alliance, s.r.o.
Otakarova 15
140 00 Prague
Czech Republic

Office: tel +420  241 741 406
      : fax +420  241 740 398
YM ID : zakmart
Email : martin.zak@gingerall.com

http://www.gingerall.com
http://www.ga-mme.com


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


Re: border-collapse workaround fop0.92beta

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 11, 2006, at 16:20, Gregor & Stefan wrote:

> <snip />
>>    border-separation="0pt"
> causes fop to throw the following exception (but the solution works  
> fine
> without the attribute):

Oops! Completely forgot: this was a bug in 0.92, and recently fixed,  
so works only in FOP Trunk.

I think it might work in 0.92 if you use:
border-separation="0pt 0pt" (specify both ipd and bpd components)

But I'm not 100% certain...

Cheers,

Andreas


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


Re: border-collapse workaround fop0.92beta

Posted by Gregor & Stefan <w2...@wikisquare.de>.
> This behaviour is correct indeed, because, for example: 
> [...]
cool thanks for the info!

> [...]
> Beware: untested, and without doing the same for the table-cells,  
> this will only work if the cells' content is not split over multiple  
> pages... :/
i'got that working even with cells over tow pages. good to know how to
realise this without border-collapse... anyway the attribute:

>    border-separation="0pt"
causes fop to throw the following exception (but the solution works fine
without the attribute):


11.06.2006 15:31:28 org.apache.fop.cli.Main startFOP
SCHWERWIEGEND: Exception
java.lang.NullPointerException
        at
org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:167)
        at
org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:114)
        at org.apache.fop.cli.Main.startFOP(Main.java:159)
        at org.apache.fop.cli.Main.main(Main.java:190)

---------

java.lang.NullPointerException
        at
org.apache.fop.fo.properties.CompoundPropertyMaker.convertProperty(CompoundPropertyMaker.java:172)
        at org.apache.fop.fo.properties.LengthPairProperty
$Maker.convertProperty(LengthPairProperty.java:61)
        at
org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:441)
        at
org.apache.fop.fo.properties.CompoundPropertyMaker.make(CompoundPropertyMaker.java:212)
        at
org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:348)
        at
org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:304)
        at org.apache.fop.fo.FObj.processNode(FObj.java:118)
        at org.apache.fop.fo.FOTreeBuilder
$MainFOHandler.startElement(FOTreeBuilder.java:308)
        at
org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:184)
        at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
        at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
$FragmentContentDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at
org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:164)
        at
org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:114)
        at org.apache.fop.cli.Main.startFOP(Main.java:159)
        at org.apache.fop.cli.Main.main(Main.java:190)


> That's a valid approach, but it seems a bit like overkill if you know  
> that it is (should be) possible in XSL-FO directly.

i need the xslt anyway for realising some pseudo table header (thats
another story) this leads to cells fitting on one page...  

cheers,
gregor


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


Re: border-collapse workaround fop0.92beta

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 11, 2006, at 11:55, Gregor & Stefan wrote:

> [...]
>> Let's say you need a border of 1pt over the whole table (=every line
>> in the grid needs to be 1pt wide), then you'd need to specify:
>> a) a border of 0.5pt for the table
>> b) borders of 0.5pt for the cells
>> c) border-separation="0pt" for the table (IIC, that's the default)
>
> my tables are flowing on several pages. and then the second and
> following top lines respectively the preceding before last bottom  
> lines
> are only  0.5pt because fop renders the table borders only over the
> whole table. i think this behaviour is correct (but im not that  
> deep in
> the specs ... maybe it's a bug ?).

This behaviour is correct indeed, because, for example:

border-after-width="0.5pt"

is the same as

border-after-width.length="0.5pt"
border-after-width.conditionality="discard"

The latter means: drop the borders at breaks. IIC, and our  
implementation supports it, then forcing the .conditionality  
component to "retain" on the table should do the trick.

Mind you: this is not possible using the border or border-width  
shorthands. If you're using those, they need to be replaced by  
separate border-specs for each side of the table.

You would need something like:

<fo:table border-collapse="separate"
   border-separation="0pt"
   border-before-width.length="0.5pt"
   border-before-width.conditionality="retain"
   border-after-width.length="0.5pt"
   border-after-width.conditionality="retain"
   border-start-width.length="0.5pt"
   border-end-width.length="0.5pt">

Beware: untested, and without doing the same for the table-cells,  
this will only work if the cells' content is not split over multiple  
pages... :/

> what i'm doing at the moment:
> 1. setting all borders to the same value
> 2. fop renders an areatree
> 3. an xslt analyses the page breaks and sets the border-bottom- 
> width to
> the apropriate value

That's a valid approach, but it seems a bit like overkill if you know  
that it is (should be) possible in XSL-FO directly.


HTH!

Andreas



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


Re: border-collapse workaround fop0.92beta

Posted by Gregor & Stefan <w2...@wikisquare.de>.
[...]
> Let's say you need a border of 1pt over the whole table (=every line  
> in the grid needs to be 1pt wide), then you'd need to specify:
> a) a border of 0.5pt for the table
> b) borders of 0.5pt for the cells
> c) border-separation="0pt" for the table (IIC, that's the default)

my tables are flowing on several pages. and then the second and
following top lines respectively the preceding before last bottom lines
are only  0.5pt because fop renders the table borders only over the
whole table. i think this behaviour is correct (but im not that deep in
the specs ... maybe it's a bug ?).

what i'm doing at the moment:
1. setting all borders to the same value
2. fop renders an areatree
3. an xslt analyses the page breaks and sets the border-bottom-width to
the apropriate value

i also tried some table-footer hacks but this was throwing errors and i
quit the idea...

cheers,
gregor



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


Re: border-collapse workaround fop0.92beta

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 10, 2006, at 23:06, Gregor & Stefan wrote:

> <snip />
> i've got that... i see no problem in setting a border in every cell...
>
>> XSL-FO refers to CSS, not HTML, so the only way to mimic that
>> behaviour is to specify the borders on the table-cells.
>
> but with border-collapse i could specify one border-with without
> thinking about the position. now i've to check every cell and set a
> different border-width to achieve an equal stroke over the whole  
> table.
>
> or do i totally misunderstood border-collapse?

Sorry, I was speaking about FOP in its current state (no complete  
support for border-collapse is implemented ATM).

You are right, in the sense that, in the separate border-model, there  
is no 'common' border between the table and the cells (or between two  
cells), but I think you can achieve the effect you need without  
having to specify a different border-width for each cell depending on  
its position...

Let's say you need a border of 1pt over the whole table (=every line  
in the grid needs to be 1pt wide), then you'd need to specify:
a) a border of 0.5pt for the table
b) borders of 0.5pt for the cells
c) border-separation="0pt" for the table (IIC, that's the default)

The total border-width of the common edges between table and cells  
becomes 1pt, as does the width of the common edges between cells.

In the collapsing border model, this would work without c), and you'd  
have to use 1pt instead of 0.5pt.
(and you could also achieve the same by using borders on the rows and  
columns, which will have no effect in the separate model)


HTH!

Andreas


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


Re: border-collapse workaround fop0.92beta

Posted by Gregor & Stefan <w2...@wikisquare.de>.
hi andreas,

thanks for the answer ... only out of interest:

[...]
> Side-note (collapsing borders are still on my mind...)
> 
> I get the impression that you would expect, when specifying a border  
> on the table, that this border is used for all cells in the table.  
> Although browsers render HTML tables like this by default, this would  
> be an incorrect interpretation of pure CSS. (It depends on HTML's  
> 'rules' attribute, for which there is no correlate in XSL-FO. The  
> described effect is the result of rules="all" in HTML.)
> 
> See the first example after the CSS rules here:
> http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders
> 
> Notice that the yellow border is *only* used for the table's edges.  
> That is: although it would win when collapsed with the cells'  
> borders, it is only used on edges that the cells have in common with  
> the table.

i've got that... i see no problem in setting a border in every cell...

> XSL-FO refers to CSS, not HTML, so the only way to mimic that  
> behaviour is to specify the borders on the table-cells.

but with border-collapse i could specify one border-with without
thinking about the position. now i've to check every cell and set a
different border-width to achieve an equal stroke over the whole table.

or do i totally misunderstood border-collapse?

cheers,
gregor



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


Re: border-collapse workaround fop0.92beta

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 8, 2006, at 20:52, Andreas L Delmelle wrote:

> <snip />
> This is basically the only way to achieve your desired result, I  
> think.
> BTW: even if border-collapse were implemented, this would still  
> work. Specifying the borders on the table-cells directly is  
> (virtually) always a good idea.

Side-note (collapsing borders are still on my mind...)

I get the impression that you would expect, when specifying a border  
on the table, that this border is used for all cells in the table.  
Although browsers render HTML tables like this by default, this would  
be an incorrect interpretation of pure CSS. (It depends on HTML's  
'rules' attribute, for which there is no correlate in XSL-FO. The  
described effect is the result of rules="all" in HTML.)

See the first example after the CSS rules here:
http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders

Notice that the yellow border is *only* used for the table's edges.  
That is: although it would win when collapsed with the cells'  
borders, it is only used on edges that the cells have in common with  
the table.

XSL-FO refers to CSS, not HTML, so the only way to mimic that  
behaviour is to specify the borders on the table-cells.

Later,

Andreas


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


Re: border-collapse workaround fop0.92beta

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 8, 2006, at 20:11, Gregor Fellenz wrote:

Hi,

> i'm using fop0.92beta to realise a fo project with a table over  
> several pages. the table layout with fop0.20.5 was pretty ok, but  
> in this version i couldn't use the keep attributes. with 0.92 i got  
> the keep attributes but i also need the same border-with across the  
> whole table.
>
> now i'm stuck with the table border implementation. i've learned in  
> the archives that the border-collapse model isn't implemented yet.  
> is there any workaround to achieve the 0.20.5 behaviour?
>
> i came across the idea to put different values in every cell to get  
> the same line width in the whole table... but before trying to  
> implement this in my xslt i just want to ask if anyone has a better  
> idea.

This is basically the only way to achieve your desired result, I think.
BTW: even if border-collapse were implemented, this would still work.  
Specifying the borders on the table-cells directly is (virtually)  
always a good idea.

HTH!

Andreas


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