Print To File Setup
I am trying to set the fields I would like exported in the print to file
setup. I have a number of fields that I would like in a csv file, but
not seen on the printed report. The fields visibility is set to false
inside the report while the fields have been selected to print out in
the print to file setup. While I was testing, I realized that this
obviously does not work. Does anyone know a way around this. Any help
would be greatly appreciated. I am using D7 and RB 9.02.
Thanks,
Nick
setup. I have a number of fields that I would like in a csv file, but
not seen on the printed report. The fields visibility is set to false
inside the report while the fields have been selected to print out in
the print to file setup. While I was testing, I realized that this
obviously does not work. Does anyone know a way around this. Any help
would be greatly appreciated. I am using D7 and RB 9.02.
Thanks,
Nick
This discussion has been closed.
Comments
Unfortunately if a text component's Visibility is set to False, the report
engine will ignore them and the drawcommand will not be created. You might
try using the Report.BeforePrint event to check the device type
(Report.DeviceType or Report.PrinterDialog.DeviceType if using that). If
your users are printing to text file, simply loop through all the components
in the report and set the visibility of the proper ones to True.
----------------------------------------------
Tech Tip: Loop Thru All Objects in a Report
---------------------------------------------
A ReportBuilder report is composed of a set
of components. The basic structure is
Reports.Bands[].Objects[]
The bands and objects within the report can
be accessed directly by object name or
via the Bands and Objects array properties.
Below is an example of using the Bands and
Objects array properties to change the font for
all objects on a report.
uses
ppClass;
procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont then
lObject.Font := aFont;
end;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com