Canvas.TextWidth on Report Script?
Hi,
I'm needing to reduce the font size when the Memo Text Width is greater than the Memo Width.
So, I thought I could do it by calculating the width of the text with each smaller font size than the actual one (for..downto). The questions are: Can I access the Canvas object of a particular memo and can I make a call for TextWidth Canvas function (the less I need to use Delphi for this, the better it is)?
Thanks in advance and sorry for the "terrific" english. :-P
Best Regards.
I'm needing to reduce the font size when the Memo Text Width is greater than the Memo Width.
So, I thought I could do it by calculating the width of the text with each smaller font size than the actual one (for..downto). The questions are: Can I access the Canvas object of a particular memo and can I make a call for TextWidth Canvas function (the less I need to use Delphi for this, the better it is)?
Thanks in advance and sorry for the "terrific" english. :-P
Best Regards.
Comments
Put this sample code on the OnBeforePrint of the Memo Object:
Marcas1 is the name of the Memo object.
Btw, I don't know if it's possible to evaluate the Memo expression in place of adding a new string. But I think that should be possible. There is a GetData procedure, but it's not accessible through script. Is there anyway to do it?
Thanks again.
ie
working in pixels
a memo with width of 248 and default character spacing etc., will display
about 35 characters arial 10 regular.
in the obp of the band you can get the length of the string datafield
if the length is greater than the known val reduce font size.
build a smal array say 3 or 4 entries of char val font size.
to get the values for the array initially
manually look at the data in the memo using different font sizes and count the characters. average no of characters may also vary depending upon character set used.
Best Regards.