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 "Tobias Anstett [k15t.com]" <to...@k15t.com> on 2009/05/20 21:18:00 UTC

Auto Table Column Width

Hi,

I know that auto table column width is currently not supported by FOP
0.9.5. But is there a way to get the actual width of a table in the
document (page - some indents) and calculate the column width like the
CSS2 algorithm does?

Or has anybody tried to render tables with iText and replace them
automatically in the generated FOP->PDF ?

-- 
Cheers,
Tobias


________
K15t Software UG (haftungsbeschränkt), http://www.k15t.com
Rosenbergstr. 58, 70176 Stuttgart, GERMANY
Registration: Stuttgart HRB 729752, VAT ID: t.b.a.
Geschäftsführer (CEO): Klaus-Dieter Krüger

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


Re: Auto Table Column Width

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Tobias,

Tobias Anstett [k15t.com] wrote:
> Hi,
> 
> please see my original question below. Furthermore I'd like to know if
> there are already approaches or ongoing development on this issue. Do
> you know how other FO processors capable of this feature have solved
> the problem. Would be nice if you can provide me additional
> information what happend so far or not - so maybe we can help and work
> on/contribute a solution in one of the next releases.

There is no ongoing work in that area at the moment, and nothing
planned. Furthermore, we are in the process of bringing major changes to
the layout engine in order to be able to handle pages of different
widths. So any work on the current code is likely to become obsolete
soon.

Like Sean said this is a complicated problem. CSS2 gives some
indications, but it remains to see how applicable they are when you take
everything into account (some columns having a set width, using
percentages to specify widths, fixed row heights, row and column
spans, page breaks, etc.). I suspect that a constraint satisfaction
problem might show up [1], or maybe something that can be solved with
the simplex algorithm [2].

At any rate, a theoretical study of the problem, without looking at any
code, would already be of great help. Things like studying the XSL-FO
Recommendation, trying to think of every situation that might occur,
looking at how web browsers behave, and gathering thoughts in a wiki
page [3]. If you want to give it a go, switch to the fop-dev mailing
list [4] to ask questions and share thoughts.

[1] http://en.wikipedia.org/wiki/Constraint_satisfaction_problem
[2] http://en.wikipedia.org/wiki/Simplex_algorithm
[3] http://wiki.apache.org/xmlgraphics-fop/DeveloperPages/
[4] http://xmlgraphics.apache.org/fop/dev/index.html#mail-fop-dev


Good luck,
Vincent



> Cheers,
> Tobias
> 
> On Wed, May 20, 2009 at 9:18 PM, Tobias Anstett [k15t.com]
> <to...@k15t.com> wrote:
>> Hi,
>>
>> I know that auto table column width is currently not supported by FOP
>> 0.9.5. But is there a way to get the actual width of a table in the
>> document (page - some indents) and calculate the column width like the
>> CSS2 algorithm does?
>>
>> Or has anybody tried to render tables with iText and replace them
>> automatically in the generated FOP->PDF ?
>>
>> --
>> Cheers,
>> Tobias
>>
>>
>> ________
>> K15t Software UG (haftungsbeschränkt), http://www.k15t.com
>> Rosenbergstr. 58, 70176 Stuttgart, GERMANY
>> Registration: Stuttgart HRB 729752, VAT ID: t.b.a.
>> Geschäftsführer (CEO): Klaus-Dieter Krüger


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


RE: Auto Table Column Width

Posted by "Griffin,Sean" <SG...@CERNER.COM>.
Tobias,
We have a similar need for auto table sizing, but we also have an additional need for "table wrapping", so we simply had to come up with an alternative solution.  Since the FO is generated from XSLT, we can pass the page width and margin values as parameters to the XSLT stylesheets that can be used to get the "body width" of the table.  Then, we have a complicated algorithm that analyzes the text that will go into each cell and calculates its approximate width based on the number of chars in the largest string in that column.  We use that value in combo with the body width to know how many columns will fit on the page and how wide each column needs to be.

At this point in time the character metrics are stored in a lookup table for a controlled set of fonts and font sizes.  Certain combinations of characters cause the metric approximation to get all haywire, though, so we're beginning to look at a way we can possibly use XSLT extension functions to have Java and its FontMetrics class better approximate the width and height of the strings.  Overall, however, the algorithm doesn't change.

>From what I've read on the mailing lists before, yes, there is a patch somewhere in the Bugzilla queue that attempts to offer some auto table sizing algorithm but that it doesn't yet work for all cases and is an *extremely complicated* algorithm to complete.

Sean

-----Original Message-----
From: Tobias Anstett [k15t.com] [mailto:tobias@k15t.com] 
Sent: Wednesday, May 27, 2009 12:40 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Auto Table Column Width

Hi,

please see my original question below. Furthermore I'd like to know if
there are already approaches or ongoing development on this issue. Do
you know how other FO processors capable of this feature have solved
the problem. Would be nice if you can provide me additional
information what happend so far or not - so maybe we can help and work
on/contribute a solution in one of the next releases.

Cheers,
Tobias

On Wed, May 20, 2009 at 9:18 PM, Tobias Anstett [k15t.com]
<to...@k15t.com> wrote:
> Hi,
>
> I know that auto table column width is currently not supported by FOP
> 0.9.5. But is there a way to get the actual width of a table in the
> document (page - some indents) and calculate the column width like the
> CSS2 algorithm does?
>
> Or has anybody tried to render tables with iText and replace them
> automatically in the generated FOP->PDF ?
>
> --
> Cheers,
> Tobias
>
>
> ________
> K15t Software UG (haftungsbeschränkt), http://www.k15t.com
> Rosenbergstr. 58, 70176 Stuttgart, GERMANY
> Registration: Stuttgart HRB 729752, VAT ID: t.b.a.
> Geschäftsführer (CEO): Klaus-Dieter Krüger
>

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

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


Re: Auto Table Column Width

Posted by "Tobias Anstett [k15t.com]" <to...@k15t.com>.
Hi,

please see my original question below. Furthermore I'd like to know if
there are already approaches or ongoing development on this issue. Do
you know how other FO processors capable of this feature have solved
the problem. Would be nice if you can provide me additional
information what happend so far or not - so maybe we can help and work
on/contribute a solution in one of the next releases.

Cheers,
Tobias

On Wed, May 20, 2009 at 9:18 PM, Tobias Anstett [k15t.com]
<to...@k15t.com> wrote:
> Hi,
>
> I know that auto table column width is currently not supported by FOP
> 0.9.5. But is there a way to get the actual width of a table in the
> document (page - some indents) and calculate the column width like the
> CSS2 algorithm does?
>
> Or has anybody tried to render tables with iText and replace them
> automatically in the generated FOP->PDF ?
>
> --
> Cheers,
> Tobias
>
>
> ________
> K15t Software UG (haftungsbeschränkt), http://www.k15t.com
> Rosenbergstr. 58, 70176 Stuttgart, GERMANY
> Registration: Stuttgart HRB 729752, VAT ID: t.b.a.
> Geschäftsführer (CEO): Klaus-Dieter Krüger
>



-- 
Cheers,
Tobias


________
K15t Software UG (haftungsbeschränkt), http://www.k15t.com
Rosenbergstr. 58, 70176 Stuttgart, GERMANY
Registration: Stuttgart HRB 729752, VAT ID: t.b.a.
Geschäftsführer (CEO): Klaus-Dieter Krüger

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