Dear Wiki user, You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" for change notification.
The "AutoTableLayout" page has been changed by GregorBerg: https://wiki.apache.org/xmlgraphics-fop/AutoTableLayout?action=diff&rev1=5&rev2=6 * LM as abbreviation for !LayoutManager == Simple Tables == - ==== Without Breaks ==== + === Without Breaks === ||<tablewidth="auto">a ||b ||c || ||a ||ab ||a b c || @@ -41, +41 @@ After the table was inspected, each column has a !MinOptMax instance representing its viable widths. Since the sum of all max values is less than the available space, the opt value (initialized as ''max'') does not need to be changed. All columns are rendered using their respective opt/max value. - ==== With Breaks ==== + === With Breaks === ||<tablewidth="200px">a ||b ||c || ||a ||abcdefghijklmn ||a b c d || @@ -61, +61 @@ In the example, columns a and b use their max(=min=opt) value, while column c uses its opt value which was shrinked (min = w(character), opt = w(2 characters and a space), max = ("a b c d")). As a result, column c is rendered with a linebreak. + '''Note: '''Columns with a static width (e.g. "2cm") are never resized. + - ==== Not Enough Space ==== + === Not Enough Space === In case the sum of all min values is greater than the available space, a warning ('columnsInAutoTableTooWide') is produced. FOP sets all columns to their respective min value and will most probably produce an overflow. == Cells Spanning Rows and Columns == @@ -69, +71 @@ FOP produces a !PrimaryGridUnit (PGU) for each table cell. If this table cell happens to span y rows and x columns, the corresponding x*y-1 !GridUnits are created to fill the model of the table with placeholders. Since FOP inspects a table from left to right (using a !TableRowIterator) and from top to bottom (using a lot of them), the PGU is always encountered first during the FOP's column width determination. Spanned rows do not have an impact on the column's width since (after the content of the PGU was already processed) they do not carry additional content. For spanned columns, on the other hand, the following three cases exist. - ==== Balanced Expansion/Reduction ==== + === Balanced Expansion/Reduction === ||<tablewidth="auto">a ||b ||c || ||||<style="text-align:center">abc abc abc ||a b c || In case a table cell spans several columns, its !MinOptMax determination is different. In the above example, the first cell in.. '''TODO: continue''' - ==== Requires Second Run ==== + === Requires Second Run === ||||<tablewidth="auto"style="text-align:center">abc abc abc ||a b c || ||a ||b ||c || - ==== Worst Case ==== + === Worst Case === In this case, FOP encounters a column for which no !PrimaryGridUnit can be found, except for the one in the first row. This case is ignored in HTML tables - column b is simply ignored... ||||<tablewidth="auto"style="text-align:center">ab (rowspan=2) ||c || ||a ||||<style="text-align:center">bc (rowspan=2) || @@ -94, +96 @@ == Nested Tables == So far, all scenarios only described the handling of isolated tables. However, nested tables are also quite common and, depending on their kind, require a specific treatment. - ==== Fixed Table in Auto Table ==== + === Fixed Table in Auto Table === - ==== Auto Table in Auto Table ==== + === Auto Table in Auto Table === ---- = Some Random Ideas = Today, FOP works with the Knuth element model in both inline- and block-progression-directions. For the auto table layout, we can make use of the inline Knuth element lists generated for content in table-cells. Before the line-breaking is done all the elements are gathered. By finding the largest/widest non-breakable sequence in an element list we can determine the minimal width of a column. By determining the full (unbroken) length of each element list involved we know how wide a column would have to be to accomodate the content without breaking it. Ideally, that latter value is used for the column width but if all the columns together would make the table wider than it can be, the column widths have to be reduced, in an extreme situation, down to the minimum established by the former value. I don't want to suggest any details on how to determine what effective width a column should get. The only purpose of the above is to give an idea for an approach to implement auto table layout. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
