If I remove the group by setting the report property it's all OK but.. if i reanable the group when i call the print method of the report it raise an exception...how can I do?
What exception are you receiving? Make sure you store the reference to the group object property because once you set the group's Parent property to nil you can't access it though the Report.Group property anymore.
There is a group object on the form, ppGroup1 for example. Instead of trying to nil its report property, you should set the group header and footer bands to visible = False and set the group StartNewPage property to False.
..it's the same ... I disable the group and print...all ok... I reanable the group and print..all ok... I re-disable the group and print ... it raise an exception EPrintError.
ppgroup1.HeaderBand:=nil; ppgroup1.FooterBand:=nil; ppreport1.Print; //all ok .... ppgroup1.HeaderBand:=myGroupHeader; ppgroup1.FooterBand:=myGroupFooter; ppreport1.Print; // all ok .... ppgroup1.HeaderBand:=nil; ppgroup1.FooterBand:=nil; ppreport1.Print; // EPrintError
...and this way is wrong because when I disable the group I've to print from different query that haven't the field ppGroup1.FieldName.. so.. if I solve the error..EPrintError ...I have another error... Field not Found..
Don't nil out the bands or groups, just set their visible properties. The bands won't generate if they aren't visible. You can leave the group attached to the report, you just need to set the group object's properties so that it won't start a new page or new column, or keep together when the report runs. To re-enable the grouping, you can set the group heeader and footer bands to visible = true, and reset the group properties back to true, such as Group1.KeepTogether := True.
Comments
ppReport.Group[0].Report:= nil;
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
if i reanable the group when i call the print method of the report
it raise an exception...how can I do?
Raf
"Alexander Kramnik (Digital Metaphors)" ha
group object property because once you set the group's Parent property to
nil you can't access it though the Report.Group property anymore.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I Disable my Group by setting the Report property of the Group:
MyReport.Groups[0].Report:=nil;
..but if I reanable the group:
MyGroup.Report:=MyReport;
Raf.
"Alexander Kramnik (Digital Metaphors)" ha
MyReport.Groups[0].Report:=nil;
I print the report..It's all OK....
I reanable the group:
MyGroup.Report:=MyReport;
I print the report..It's all OK....
I Re-Disable my Group...
MyReport.Groups[0].Report:=nil;
I print the report and it raise an EPrintError
Raf
to nil its report property, you should set the group header and footer bands
to visible = False and set the group StartNewPage property to False.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I reanable the group and print..all ok...
I re-disable the group and print ... it raise an exception EPrintError.
ppgroup1.HeaderBand:=nil;
ppgroup1.FooterBand:=nil;
ppreport1.Print; //all ok
....
ppgroup1.HeaderBand:=myGroupHeader;
ppgroup1.FooterBand:=myGroupFooter;
ppreport1.Print; // all ok
....
ppgroup1.HeaderBand:=nil;
ppgroup1.FooterBand:=nil;
ppreport1.Print; // EPrintError
...and this way is wrong because when I disable the group
I've to print from different query that haven't the field
ppGroup1.FieldName..
so.. if I solve the error..EPrintError ...I have another error... Field not
Found..
Raf
PS. Excuse me for my bad english.
bands won't generate if they aren't visible. You can leave the group
attached to the report, you just need to set the group object's properties
so that it won't start a new page or new column, or keep together when the
report runs. To re-enable the grouping, you can set the group heeader and
footer bands to visible = true, and reset the group properties back to true,
such as Group1.KeepTogether := True.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com