How to align Memos when they can contain multiple lines
hello,
I create several memos at runtime. I create 2 memos pro line, one memo for a title, one memo for the value. I set the Y position and the height programmatically . Then as I know the Y position and the Height I can calculate the next Y position for the 2nd line. The report looks basically like that
see pic1
I face a problem when the value takes multiple lines. Let's take the following example (wished result)
see pic 2
I need to count how many lines the Value would take in order to give the right Height and calculate the Y position for the next row properly. How do I do that?
I tried to create at run time a temp Memo and add the text and use memo.Lines.Count to calculate the Height or memo.calcHeight , but it isn't working, I get 1 for memo.Lines.Count and 0 for memo.calcHeight
If I play with the property StretchMode I get the following result
see pic 3
The titles aren't aligned anymore.
What is it recommended to do?
Thanks
I create several memos at runtime. I create 2 memos pro line, one memo for a title, one memo for the value. I set the Y position and the height programmatically . Then as I know the Y position and the Height I can calculate the next Y position for the 2nd line. The report looks basically like that
see pic1
I face a problem when the value takes multiple lines. Let's take the following example (wished result)
see pic 2
I need to count how many lines the Value would take in order to give the right Height and calculate the Y position for the next row properly. How do I do that?
I tried to create at run time a temp Memo and add the text and use memo.Lines.Count to calculate the Height or memo.calcHeight , but it isn't working, I get 1 for memo.Lines.Count and 0 for memo.calcHeight
If I play with the property StretchMode I get the following result
see pic 3
The titles aren't aligned anymore.
What is it recommended to do?
Thanks
Comments
Do you use DetailData or MasterData for theese title ?
If titles are fixed and you use MasterData and if you dont use borders and you can workaround like :
extend Title B little bit longer like in attached picture and use 'shift when overlap' option.
This will only work if titles are fixed, if you use DetailData or Subreport this workaround wont work.
If you find any solution beside that please let me know too
Regards,
boakoms.
Thanks for the reply.
I use a MasterData. I didn't understand your solution completely. The desired behavior is to have titles and values always aligned, like in a grid in Word.
I finally manage to have the desired behaviour, but I needed to insert a Childband for each couple Label-Value. This way, if a row takes 2 lines that will shift everything down and the alignment will still be persistent. And we don't need to bother about the Y position. We insert a childband, then 2 labels for the title and value at position 0. Then we create a childband to the previous childband, create 2 labels at position 0.