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

Comments

  • edited 5:28AM
    Hello,

    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.
    bruchr79 wrote: »
    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
  • edited 5:28AM
    Hi,
    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.

    boakoms wrote: »
    Hello,

    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 [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Regards, boakoms.[/img]
  • edited 5:28AM
    I just understood what you meant, and it's working. Thank you very much. I thought that would also shift horizontally, which isn't wanted, but indeed if I set the title width long enough to have a little overlapping on the memo for the value, and set shiftmode property to ShiftwhhenOverlapped, then if the above value takes more that one line, both value and title memos will be shifted down and therefore will be aligned.
    bruchr79 wrote: »
    Hi,
    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.

Leave a Comment