[DUG] Setting tabs on a printer

Marshland Engineering marshland at marshland.co.nz
Tue Dec 8 14:00:56 NZDT 2009


I can't send a tab setting to the printer 
The routine works with a memo but fPrn.Handle gives and error.
Something to do with fPrn and system.text   



procedure TfMain.puExpListClick(Sender: TObject);
var
   fPrn: system.text;
   TabArray : array[0..4] of integer;
begin
   TabArray[0] := 350;// div DialogUnitsX;  //Tab Positions
   TabArray[1] := 380; //div DialogUnitsX;
      begin
         with Printer.Canvas do begin
            PrinterSetupDialog1.execute;
            Font.Name := 'Courier New';
            Font.size := 14;
            AssignPrn(fPrn);
            Rewrite(fPrn);
            SendMessage(fPrn,EM_SETTABSTOPS,2,LongInt(@TabArray)) ; // This line does not work
            SendMessage(fPrn.Handle,EM_SETTABSTOPS,2,LongInt(@TabArray)) ; //This gives an error.
            // SendMessage(memo.Handle,EM_SETTABSTOPS,2,LongInt(@TabArray)) ; //This works on the memo.
        end;
      end
   dm.tblExpJob.First;
         begin  // Heading
            with Printer.Canvas do begin
               Font.size := 12;
               WriteLn(fPrn,#10+#10);
               WriteLn(fPrn,'     '+dm.tblData['Desc']+#13+#10);
               Font.Size := 10;
            end;
         end

etc

            WriteLn(fPrn,'  '+dm.tblExpJob.FieldByName('Date').AsString
            +'  '+dm.tblExpJob.FieldByName('Desc').AsString
            +'  '+#9+dm.tblExpJob.FieldByName('Person').AsString)  // Trying to format the Person on TAB
         CloseFile(fPrn);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20091208/cdd77e9a/attachment.html 


More information about the Delphi mailing list