On Tue, 2004-05-25 at 18:14, Andreas L. Delmelle wrote: > > -----Original Message----- > > From: James Earl [mailto:[EMAIL PROTECTED] > > > > Hi James, > > > Thanks for the example. > > > > vMax is a string length in this example though, right? Correct me if > > I'm wrong, but I don't think proportional-column-width() will work with > > a string length will it? > > > > Hmm.. Not sure what *exactly* you are referring to, but XSLT's > string-length() function returns a number, and that number is what gets fed > to the proportional-column-width() function. > > Don't know if you have read up on the definition of > proportional-column-width(), but it works more or less as follows: > > - first all other specified column-widths are resolved (explicitly set to an > absolute or a percentage value) > - the total of these is subtracted from the table-width > - then, for all remaining columns whose width is defined by p-c-w(), the > total of the numbers is made, and the remaining table-width is distributed > over these columns along the proportions that are specified > > So, if you have two columns like this: > <fo:table-column column-width="proportional-column-width(1)" /> > <fo:table-column column-width="proportional-column-width(5)" /> > > The second one will always be 5 times as wide as the first, no matter what > else...
I did read up on proportional-column-width() on w3.org, but your description of it makes things more clear. Thanks! I understand your example above, where one column is always 5 times as wide as the first. The only thing that was confusing me is that (in your first example) if string-length() returned a value of say 24, because you have a column with a maximum string length of 24 characters, then that column would be 24 times the width of all the rest... wouldn't it??? > > Using string-length() is indeed a bit rudimentary, in that it can, strictly > speaking, only approach the actual text-width when a fixed-width font is > used further on. If you want to refine that, you would need to take into > account the font-metrics as well... Also, the proportions will only look > nice if you have all rows of the same height (meaning: no line-breaks inside > cells) Sure, this too can be compensated for. > > Say you have a max record width (sum of all respective max field widths) of > 65, then each column gets its width according to a calculation like > > [( proportional-width / 65 ) * remaining-table-width ] I'm very poor with math, but this makes more sense to me (the paragraphs above) - using the maximum string lengths to calculate a proportional integer. I'll have to try to apply this in my application and see if I can better understand it through doing it! > > Other than that... could it be that you're a bit misled by the subtle > difference between XSLT and XSL-FO (?) The result of string-length() is > resolved long before FOP starts digesting the actual fo:table-column, so FOP > sees nothing of the string-length() function. That's the XSLT processor's > realm... Ya, XSLT just spits out the XSL-FO, which is then processed by FOP. I don't think I have a complete understanding of proportional-column-width() yet. I'll play around with it some more using the information you'd provided to me and see what I can learn. Thanks I'll post any success that I have! > HTH! > > Greetz, > > Andreas > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]