Toggle navigation
ReportBuilder Support Forums
Categories
Discussions
Activity
Sign In
Home
›
General
ReportBuilder 22.06 now available including Delphi 12.2 support!
New Blog Posts: Merging Reports -
Part 1
and
Part 2
Text To Printer, Example 107
rbuser
August 2001
edited August 2001
in
General
Hi All:
Report Builder comes with a demo, #107, that illustrates how to "print" a
report to a text file. Does anyone have example code on the best way to send
this text file to a printer?
Thanks,
Mike
Comments
digitalmetaphors
August 2001
edited August 2001
-----------------------------------------------
Tech Tip: Send TextFile to Printer
-----------------------------------------------
I designed a application that exports the report to a .txt
file using ReportTextFile device.
How can I Send the text file to the printer?
The following procedure will send the .txt file to
the printer using Delphi's TPrinter object.
uses
Printers;
procedure SendTextFileToPrinter(aFileName: String);
var
lsLines: TStringList;
lOutputFile: TextFile;
liIndex: Integer;
begin
lsLines := TStringList.Create;
try
lsLines.LoadFromFile(aFileName);
AssignPrn(lOutputFile);
Rewrite(lOutputFile);
for liIndex := 0 to lsLines.Count-1 do
Writeln(lOutputFile, lsLines[liIndex]);
CloseFile(lOutputFile);
finally
lsLines.Free;
end;
end;
Cheers,
Jim Bennett
Digital Metaphors
Digital Metaphors Corporation
http://www.digital-metaphors.com
info@digital-metaphors.com
This discussion has been closed.
Comments
Tech Tip: Send TextFile to Printer
-----------------------------------------------
I designed a application that exports the report to a .txt
file using ReportTextFile device.
How can I Send the text file to the printer?
The following procedure will send the .txt file to
the printer using Delphi's TPrinter object.
uses
Printers;
procedure SendTextFileToPrinter(aFileName: String);
var
lsLines: TStringList;
lOutputFile: TextFile;
liIndex: Integer;
begin
lsLines := TStringList.Create;
try
lsLines.LoadFromFile(aFileName);
AssignPrn(lOutputFile);
Rewrite(lOutputFile);
for liIndex := 0 to lsLines.Count-1 do
Writeln(lOutputFile, lsLines[liIndex]);
CloseFile(lOutputFile);
finally
lsLines.Free;
end;
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com