How to get a Memo to 'Stretch' correctly?
I have a memo and a sub report in one master band.
In a previous topic { How to make group headers work?, (with the text vertical!) from May 17 2012 } the user 'gpi' suggested that I should set the stretch property of the master band to true and the stretchmode property of the memo to SmMaxHeight. The example report they posted works OK.
I am sure I have done exactly what gpi suggested but in my report the memo still displays at the design height, not the height of the sub report.
Below are screen shots of the properties of the master band, the memo I want to stretch and what the report looks like.
In the report the green memo is the one that should be stretched and the blue line shows qwhere the memos should be streched to.
Can anyone see where I am going wrong?
Master band
In a previous topic { How to make group headers work?, (with the text vertical!) from May 17 2012 } the user 'gpi' suggested that I should set the stretch property of the master band to true and the stretchmode property of the memo to SmMaxHeight. The example report they posted works OK.
I am sure I have done exactly what gpi suggested but in my report the memo still displays at the design height, not the height of the sub report.
Below are screen shots of the properties of the master band, the memo I want to stretch and what the report looks like.
In the report the green memo is the one that should be stretched and the blue line shows qwhere the memos should be streched to.
Can anyone see where I am going wrong?
Master band
Comments
it appears to me that the top of the memo is set to 0, i think this might be outside of the master band top
forget the above,
try removing the sub report temporarily to see if you can get the memo to stretch also what is wordwrap set to
Removing the subreport didn't print anything, not even the memo. But I didn't expect that to work as the memo has nothing to stretch against. ie if there is nothing on its right hand side to make the data band get taller, why should it stretch at all.
Yes memo.top = 0 but that is 0 with respect to the data band so that should be OK
The words in the memo are at 90 degrees if that's any help.
Also this is quite a nested report
Master data 1 (fed by a data set with one record per student) contains just a subreport called SubreportOneFaculty (but will show other stuff later)
My screen shot of the report just showed the first left hand memo from SubreportSubjectData as the rest just contain numbers. Its SubReportOneFaculty thats not working as it won'tstretch the faculty name alongside the subreport showing all subjects within that faculty.
Hope thay helps
In the end, through trial and error I have come up with the solution but it introduces another problem if the band with the memo and subreport on are themselves in a subreport from a higher level.
If there is a master band containing a memo next to a subreport and you want the memo stretched vertically to occupy the same height as the results of the subreport then the properties must be set as folows.
For the memo
Memo1.DataField := nil;
Memo1.DataSet := nil;
and in the memo place the data that you want to show eg [frxDBDataset1."MyField"]
For the subreport
Subreport1.PrintOnParent := true; //<-- this appears to be the crucial line
Setting Subreport1.PrintOnParent := true; appears to be the important line.
Without it all the lines of the sub report appear correctly and the memo correctly appears once per set of sub report lines but the memo doesn't stretch.
With Subreport1.PrintOnParent set to true set the memo does stretch to fit the size of the sub report results
Note:
HOWEVER this causes the subreport to overtprint the previous time it displayed data causing the data to be unreadable. See below where a subreport shows the faculty plus the results of another subreport showing subject group and Mastery Average. There are 8 subject groups within 4 faculies but the Mastery Average for PE and Art have been overwritten
interesting that when the memo contains just an expression it stretches but not when connected to a datafield.
in that master band was the subreport created(added) before the memo?