Subject: Re: [xsl] Table columns - fixed span width with underlying "auto" layout columns From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx> Date: Thu, 24 Feb 2011 01:38:01 -0500 |
On Wed, Feb 23, 2011 at 9:30 PM, Murray McDonald <m.mcdonald@xxxxxxxxx> wrote: > I still need to deal with the underline part of the problem. The length of > the underline that should be used throughout the column is determined by the > widest data entry (excluding any data that hangs) That's why I was thinking > of "splitting" these columns into 3 columns, one to hold any content that > needs to hang, one to hold (and right-align) the numeric data and also > correctly "size" the underlines, and the leftmost column to pad the whole > thing out to the calculated width. Instead of the multiple columns, how about a variation on the hidden inline trick? This one is going to be a bit more complex and bloat your FO code a bit, but with XSLT doing the heavy lifting, who cares, eh? :) Assuming you have negative percentages somewhere in the table (so you need to leave space for both "%" and ")"), then for a value of -$123 (rendered as "($123)"), you'd have something like this: <block line-height="1"> <inline-container> <block>($123</block> <!-- block-containers --> </inline-container> <inline>)</inline><inline visibility="hidden">%</inline> </block> The inlines at the end are for the visible and invisible hanging punctuation, respectively. The line-height on the outer block is to prevent the line getting extra tall due to the nested blocks. The inline-container sets up a reference area in which we can position other blocks, which brings us to the block-containers, of which there will be one for each data entry in the column (the entire column being copied, in this form, in every row), like this: <block-container absolute-position="absolute" bottom="0" right="0"> <block> <inline border-bottom="solid 1pt black"> <inline visibility="hidden">($123</inline> </inline> </block> </block-container> Each block-container is anchored in the lower-right corner of the inline-container, so they all stack on top of each other. The actual text content is hidden, but provides the correct width for the inline wrapper with a bottom border. Because all of the values in the column are in the "stack", the visible result is a line as long as the widest entry. -Brandon :) > On 23/02/2011 7:45 PM, Brandon Ibach wrote: > > The most elegant solution I can think of would be to use the > text-align="<string>" property to align the numeric values on a > zero-width space between the final digit and any "%" or ")", but the > documentation on XEP indicates that it doesn't support that feature. > > The next best choice would probably be the multi-column solution, only > I think you should be able to do it with just two columns, as I don't > see the need for the one to the left. I'm not completely clear on how > you're doing the layout, though. Is your XSLT calculating fixed > widths for each column, or are you relying on XEP to do auto-layout? > > I can think of one other option that might work, though it is a bit of > a hack. Pre-scan the content in your XSLT to determine if any entries > will need a "%", a ")" or both. Then, while generating each entry, > add any of those symbols not needed by that entry in an<fo:inline > visibility="hidden"> at the end. Combined with text-align="right" on > the block (and possibly a keep-together to make sure there's no > wrapping), this should reserve the needed space to line everything up. > > -Brandon :)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Table columns - fixed spa, Murray McDonald | Thread | Re: [xsl] Table columns - fixed spa, Murray McDonald |
Re: [xsl] pulling object at their c, Ganesh Babu N | Date | Re: [xsl] pulling object at their c, Michael Kay |
Month |