Patch
For my songbook design project I needed a XSL-FO Processor that could handle table-layout = auto.
XEP supports this perfectly, but FOP doesn’t and from the looks of it, it won’t in the foreseeable future.
Fortunately there is a patch available that adds very basic support for auto table-layout.
The patch won’t work with current trunk, it’s written for a revision from around June 2009. It’s not too old, but also not very new. I haven’t tried to find a revision that is more current then the revision it is targeted at, so it may well be possible that it works for let’s say a January 2010 revision. If you do, please leave a comment about your mileage.
Instructions
You’ll need to check out revision 783305 from fop-trunk. Apply the patch and let ANT build it. Shouldn’t take long. The result is a working auto-table-layout capable FOP.
Limitation
Limitation of the patch is that you can’t apply a margin-left to the table, or the containing block(s!). If you do that, the table reverts somehow to the original table layout system.So it only works if the table starts at the left side of the page, with no margin. That’s quite restricting.
Workaround
To work around this, you can use the following ugly hack:
Wrap your table in another 2-column table. Set the width of the first empty column to the required margin, fill the second column with the table you need. The 2nd table will now auto-layout properly.
Hi,
Nice workaround, but any sample code would be appreciated 🙂
Hi, what kind of code where you thinking of? I must say I haven’t used FOP for years, so I doubt I can really provide anything else besides the stuff mentioned here. And the wrapping table stuff should be quite easy I think.