stopping page throw at end of print
Dear all,
if I have a sheet of labels with 8 on a sheet (1 column) and I
have 2 print jobs (loading 2 different report) one of qty 3 and one of qty
4, I want them both to rint on the same sheet, but at the end of the first
report.print, the printer throws the page. How do I stop this if the bands
printed is less than the bands per page?
regards
John
if I have a sheet of labels with 8 on a sheet (1 column) and I
have 2 print jobs (loading 2 different report) one of qty 3 and one of qty
4, I want them both to rint on the same sheet, but at the end of the first
report.print, the printer throws the page. How do I stop this if the bands
printed is less than the bands per page?
regards
John
This discussion has been closed.
Comments
Two options...
1. Combine the two reports you currently have into a single report
essentially creating one print job. This can be done in a number of ways
including the use of Section Style subreports. (See demos 51 and 52 in the
RBuilder\Demos\1. Reports\... directory.
2. You can use the techinque used in the following example to print the
first report, then using the same piece of paper, print the second report
skipping over the labels you've already printed. This would require you to
extract the paper and re-feed it into the printer.
http://www.digital-metaphors.com/tips/SkipLabels.zip
Note: The fact that the printer is finishing the page after the print job
is a printer specific feature, RB has no control over this. There are very
few printers that will not finish the page once a print job has completed.
These are usually POS or label printers. If you are using this type of
printer, there may be an option in the driver software to stop the paper
after a print job.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I can see that having 2 or more reports in subreports would
allow it to print as one print job with no page throws.
Since I am creating each report in turn using loadfromdatabase, how do I do
create a single report file using loadfromdatabase. Is there some sort of
subreport.loadfromdatabase?
regards
John
Yes, assuming you are loading templates from your database, you can use the
Template object to load your reports.
Once you set up the Template.DatabaseSettings, you can call the following to
load the templates directly into the subreports.
Subreport.Report.Template.LoadFromDatabase;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
still struggling with this.
I have my report, ppreport3. If I create a subreport in it for each line in
my print job, they will print out continuously.
I am doing something like:
subrep1:=Tppsubreport.create(nil);
ppreport3.addchild(subrep1);
subrep1.report.datapipeline:= pipeline1;
(locate report in database)
subrep1.report.template.loadfromdatabase;
I am getting an AV on the loadfromdatabase.
Is my adding of the subreport to the report correct?
what else do I need to do?
thanks
John
Take a look at the following article on creating subreports in code.
-------------------------------------------------
TECH TIP: Creating a SubReport in Code
-------------------------------------------------
A subreport is comprised of two objects:
1. SubReport control
The subreport control is added to a band of the
'parent' report. It has properties such as
ShiftRelativeTo, PrintBehavior, etc.
In the Report Designer, the subreport is drawn
as a rectangle.
2. ChildReport
The child report is a descendant of CustomReport and has
most of the same properties as a standard Report.
The child report has a separate layout workspace in the report
designer that is accessible by selecting the tabs at the bottom
of the designer.
When dynamically creating a subreport in code you need to
create the subreport and the underlying child report.
The subreport.Report property can then be used to access
the child report.
This is demonstrated in the following example:
var
lSubReport: TppSubReport;
lReport: TppChildReport;
lLabel: TppLabel;
lDBText: TppDBText;
begin
lSubReport := TppSubReport.Create(Self);
{add to the main report's detail band}
lSubReport.Band := ppReport1.DetailBand;
{create the child report (parameters: main report) }
lSubReport.CreateReport(ppReport1);
lReport := TppChildReport(lSubReport.Report);
{assign a datapipeline}
lReport.DataPipeline := plCustomers;
{create the default set of bands}
lReport.CreateDefaultBands;
lLabel := TppLabel.Create(Self);
lLabel.Band := lReport.TitleBand;
lLabel.Caption := 'Customers';
lLabel.Font.Name := 'Times New Roman';
lLabel.Font.Size := 24;
lDBText := TppDBText.Create(Self);
lDBText.Band := lReport.DetailBand;
lDBText.DataPipeline := plCustomers;
lDBText.DataField := 'CustNo';
lDBText.Color := clYellow;
lDBText.Font.Name := 'Times New Roman';
lDBText.Font.Size := 12;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
still not there, I now have:
vars
subrep1, subrep2, subrep3:TppSubReport;
chReport1, chReport2: TppChildReport;
begin
FSkip:=0;
datamod.qNewLabels.close;
datamod.qNewLabels.open;
thisreport:=0;
while not datamod.qNewLabels.Eof do
begin
if thisreport=datamod.qNewLabelsrecno.AsInteger then
else
begin
j:=j+1;
thisreport:=datamod.qNewLabelsrecno.Asinteger;
case j of
1:
begin
subrep1:=Tppsubreport.create(nil);
subrep1.Band:=ppReport3.DetailBand;
SubRep1.CreateReport(ppReport3);
chReport1 := TppChildReport(SubRep1.Report);
chReport1.CreateDefaultBands;
chreport1.Template.DatabaseSettings.DataPipeline:=pipedb;
chreport1.Template.DatabaseSettings.NameField:='itemname';
chreport1.Template.DatabaseSettings.TemplateField:='template';
chreport1.DataPipeline:=ppDBPipeline1;
if
ReportLocateRecordEvent(sender,datamod.qNewLabelsitemname.AsString) then
chreport1.Template.LoadFromDatabase;
The locaterecordevent definitely finds the record, but I get "record not
found" on the loadfromdatabase event.
Another question.
I know which printer a report should go to, how can I set that to be the
default printer programmatically?
kind regards
John
You also need to assign the name of the template so ReportBuilder can find
the specific template you want to load. This is the value of the NameField.
chreport1.Template.DatabaseSettings.Name := 'myTemplate';
ReportBuilder uses the windows Default printer as the default printer
available in the print dialog. In order to change this, the default printer
for the machine will need to be changed. You can use the combo box to
select any other printers you would like or you can assign the
Report.PrinteSetup.PrinterName property so the dialog will automatically
show a certain printer.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com