Hi Craig, I'm sorry I don't have a solution for your problem, but if you can change your requirements from "header repeated in each colum" to "header repeated on each new page", then markers would be your way to go, I guess.
Or, as Jeremias suggested, some ugly coding. I did not try that, just thinking aloud: Since each column needs a header anyway, the first headers might be relocated to the page header section. There you have a 7-cell table spanning the whole page width. For layouting purposes all cells would contain the longest possible classification header or a fixed height. Now generate the area tree of the page and find out, which classification is the first in each column. Write this header into the table and generate the page again. This approach breaks as soon as the table height is different between the two runs. It's ugly, but it may work. Regards, Georg Datterl ------ Kontakt ------ Georg Datterl Geneon media solutions gmbh Gutenstetter Straße 8a 90449 Nürnberg HRB Nürnberg: 17193 Geschäftsführer: Yong-Harry Steiert Tel.: 0911/36 78 88 - 26 Fax: 0911/36 78 88 - 20 www.geneon.de Weitere Mitglieder der Willmy MediaGroup: IRS Integrated Realization Services GmbH: www.irs-nbg.de Willmy PrintMedia GmbH: www.willmy.de Willmy Consult & Content GmbH: www.willmycc.de -----Ursprüngliche Nachricht----- Von: Craig Ringer [mailto:cr...@postnewspapers.com.au] Gesendet: Montag, 21. Juni 2010 18:48 An: fop-users@xmlgraphics.apache.org Betreff: Distributing vertical space in a column while repeating column headings Hi all I'm new to Apache FOP, and XSL-FO in general, so if this is a stupid question please accept my apologies in advance. I've read the FAQ, endless XSL-FO docs (including the ... dense ... spec), and searched the list archives, so I'm not popping up without doing some research. The short version is that I can't figure out how to distribute vertical space to avoid ragged column bottoms in multi-column pages when the flow contains several long-ish one-column tables. Why one-column tables? Because I have sections with headings that must be repeated at the top of a column if split across columns. I'm writing a (to be open source) app to automatically paginate classified ads to PDF, as I've been unable to find an acceptable commercial solution at a reasonable price or locate any decent OSS offering. I'm trying to use XSL-FO for layout, and need to produce multi-column output, with column content flowing from bottom-left to top-right along the columns. I'm using <fo:simple-page-master column-count="7" ... /> to achieve that with no fuss. The content is blocks of text and graphics that either have large widow/orphan limits or cannot be split across columns at all, so elastic spacing is required to avoid huge ragged blobs of whitespace at the bottom of columns. This is easy enough using elastic space-before[1] if each ad is in its own <fo:block> that's directly flowed into the column. The tricky bit is that these collections of text blocks and images are grouped into classifications, each of which must have a heading. If the classification spans more than one column, **the heading must be repeated at the top of the column**. I'm satisfying this requirement by putting the ads in each classification into a one-column table and using <fo:table-header/> to provide a repeating header. It's ugly, but it works. However, I can't figure out how to specify elastic spacing to distribute space between rows in the table and between tables. Table rows don't have a space-before attribute. Adding elastic space-before to the <fo:block/> within each table cell appears to have no effect. And there's no display-align="justify" that would spread spacing evenly line-by-line within all objects [2], as would be ideal. I can specify elastic space-before for each table as a whole, but to have much effect I need so much space that large holes open up between tables, while the rows within the tables remain cramped. (a) I need elastic spacing to prevent big, uneven chunks of whitespace at the bottom of columns; but (b) I need to repeat classification headings at the top of columns, and can only seem to do that with 1-column tables, the use of which seems to prevent effective elastic spacing. I've been trying to figure out a way to use the block-progression-dimension attribute to achieve this, as it seems to be a more generalized form of elastic sizing. However, I just can't figure out how to use it to express a flexible "expansion" amount. To use it, I seem to already have to know how big the block needs to be to hold its contents, so I can set the minimum, optimum, and maximum appropriately. Is there any way to do this? Or am I barking up the wrong tree entirely? Is there a way to achieve repeating column headings that'll let me avoid wrapping sections (classifications) up in one-column tables, so I can use the usual elastic spacing mechanism? Is there any notional equivalent of display-align="justify" ? And if so, any way to limit that justification or set a threshold of whitespace percentage over which it won't try to do it? Since I know how frustrating it is to see such questions without concrete code: here's a sample XSL-FO document, generated from last weeks' newspapers published classified ads: http://www.postnewspapers.com.au/~craig/fo_question/cl_pdf.fo and the PDF fop produces for it: http://www.postnewspapers.com.au/~craig/fo_question/cl_pdf.pdf The FO and PDF for another advertising section is also present, but is less useful because it requires a huge bunch of referenced images to paginate: http://www.postnewspapers.com.au/~craig/fo_question/tr_pdf.fo http://www.postnewspapers.com.au/~craig/fo_question/tr_pdf.pdf ( In that directory there's also an XSLT transform (ads_to_fo.xml) and the source xml (cl.xml and tr.xml), not that it's really relevant to the question. ) [1] http://old.nabble.com/display-align%3D%22justify%22-ts8772141.html#a8772141 [2]http://article.gmane.org/gmane.text.xml.fop.user/25707 -- Craig Ringer --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org