In the picture below is the report shown in designer
and in the next picture is the desired result.
The field bb is a memo field with variable length and set as stretched with overflow.
The goal is to center vertically with bb the other two fields, ii and aa.
First I defined two report variables.
text_height will store the actual height of the bb field for the current row, while text_top the top position.
Actually, only text_height is necessary, but for the beauty I defined also text_top.
In the bb field properties, I choose the Other tab, and then I clicked The Edit settings from Run-time extensions.
I typed in the Execute when textbox
Render
and in the edit box above
text_height=tp5
text_top=tp3
Both in the aa and ii field properties, I choose the Other tab, and then I clicked The Edit settings from Run-time extensions.
I typed in the Execute when textbox
Render
and in the edit box above
if text_height-tp5>0
tp3=text_top+floor((text_height-tp5)/2)
endif
One problem was that ii and aa was rendered before bb, so text_height and text_top was the one from the previous row.
I simply cut the fields ii and aa (copy-cut) and then I pasted them back, and so in the frx they appear after bb and consequently was rendered after bb.
The test prg:
Code:
SET REPORTBEHAVIOR 90
CREATE CURSOR aa (ii I AUTOINC,aa C(10),bb M)
INSERT INTO aa (aa,bb) VALUES ('test 1','')
INSERT INTO aa (aa,bb) VALUES ('test 2','Short')
TEXT TO m.lcS
Lorem ipsum bibendum aenean lobortis semper a augue eget varius suspendisse quam pretium aenean vestibulum eu interdum faucibus habitasse senectus, eget nibh habitant sodales augue nam fusce quisque, semper proin viverra scelerisque quam tristique tincidunt hendrerit facilisis rutrum bibendum class nam, fusce maecenas interdum tempus lacus, ad aliquam aenean urna fusce enim pulvinar vulputate mattis porta nisi fringilla lectus.
ENDTEXT
INSERT INTO aa (aa,bb) VALUES ('test 3',m.lcS)
TEXT TO m.lcS
Dui non commodo phasellus cras nam mollis a, litora pulvinar curae sit lacus nam aliquam curabitur, volutpat convallis faucibus condimentum mollis cras phasellus id curae diam velit nisi potenti a, tortor varius porta nam eleifend duis justo, curabitur tortor phasellus dictumst ligula sapien.
ENDTEXT
INSERT INTO aa (aa,bb) VALUES ('test 3',m.lcS)
INSERT INTO aa (aa,bb) VALUES ('test 2','Second short')
REPORT FORM bb PREVIEW
My respects,
Vilhelm-Ion Praisach
Resita, Romania