Home
Analytics
Dynamic Font Size in Cross Tabs
Philipp_CH
Hi,
I have a crosstable which can have up to 15 columns or more. The detail area contains data with up to 9 digit numbers. BIRT adjusts the width of the columns automatically, but the size of the font stays the same. If the cell content is larger than the column width, it only gets displayed partially. Can BIRT automatically resize the font to fit the column width in a cross tab or table?
I tried to set font size to "Auto", but then it stays always at 10 points, no matter how wide the columns end up in the cross tab at output.
I'm using PDF output, masterpage set to A4 landscape.
Many thanks for the answer.
Cheers, Philipp.
Find more posts tagged with
Comments
mwilliams
It won't adjust the size automatically. You'd have to script the font size, probably. You could always request an enhancement, in the bugzilla, for the text size to change to fit to the page, too, at eclipse.org. What is your BIRT version? I'll see if I can come up with an example, if you'd like.
Philipp_CH
Hi Micheal,
Thanks for your quick answer. I'm using BIRT 2.6.2. I already assumed that a possible solution has to be a script. I'm looking forward to your example.
Cheers, Philipp.
mwilliams
Take a look at this example. I tried to use script within a single crosstab, but with the way a crosstab is created and rendered, at least in the designer, I was unable to get all text to change with just one. I got very close (all but 1 cell), but close wasn't all. This could just be because most of my testing came in the preview, where the runAndRender task runs. If I find a way to do it in one, I'll post it. You can see a couple are still larger if you unhide the first crosstab in the example.
The second crosstab is exactly like the first, except, I don't increment my columns variable in the second one. The second crosstab is also set up to change sizes depending on how many year columns are represented. You wouldn't have to use a second crosstab to do this. You'd just have to find the number of columns that will be in the crosstab somewhere outside the final crosstab.
To see the text size change, change the last parameter from 2005 to 2004 to 2003. Let me know if you have questions.
Philipp_CH
Hi Michael,
I'm sorry I couldn't give you earlier my feedback. I had a look into your solution and I think this could actually work for me. I can get the number of columns outside the crosstab, so I wouldn't need the hidden auxiliary one.
Many thanks for your support!
Cheers, Philipp.
mwilliams
You're very welcome. Always glad to help. Let me know if you run into any snags.