![]() |
|
#1
|
|||
|
|||
|
Hi !
How do you copy the text from a memo component to the printer canvas. As you know, when you resize the memo component, the text will always be shown between the rect margins, and if a line is too long, the compoent split the line. I need the same effect on the print, because sometimes I use a receipt printer, with short width limit. Thanks Regards Christian |
|
#2
|
|||
|
|||
|
I use the ReportSystem components from Rave to do all my printing because it makes printing simple. Here is some code that might help...
MemBuf.PrintStart := 1.35; MemBuf.PrintEnd := 6.5; MemBuf.Field := (FieldByName('Activities') as TMemoField); MemBuf.NoCRLF := False; FA := True; for I := 1 to 10 do begin MString := GetMemoLine(MemBuf,XEOL); if MString <> '' then begin if FA then begin FA := False; PrintLeft('Activities:',0.8) end; GoToXY(1.35,gYPos); PrintLn(MString); gYPos := gYPos + 0.15; end; end; This falls under a query result, each record has a Memo associated with it. George |
|
#3
|
|||
|
|||
|
Hi, how about this
procedure TForm1.Button1Click(Sender: TObject); var nLine, nPage, nLeftMargin, nTopMargin, nLineHeight, i: Integer; begin nPage := 1; nLine := 0; nLeftMargin := 30; nTopMargin := 30; Printer.BeginDoc; nLineHeight := 100; for i:=0 to Memo1.Lines.Count-1 do begin if nLine > 50 then begin nPage := nPage + 1; Printer.Canvas.TextOut(nLeftMargin, (nLineHeight*nLine)+nTopMargin, 'Page-'+IntToStr(nPage)); nLine := 0; Printer.NewPage; end; Printer.Canvas.TextOut(nLeftMargin, (nLineHeight*nLine)+nTopMargin, Memo1.Lines[i] ); nLine := nLine + 1; end; Printer.EndDoc; end; |
|
#4
|
|||
|
|||
|
Thanks for your answer.
Do you have any solution, without using this component. |
|
#5
|
|||
|
|||
|
Sorry, but I can't use this example.
You code will cut the lines, if the text is to long. |
|
#6
|
|||
|
|||
|
I think that is what MemBuf.NoCRLF := False; is for. I don't have any broken line problem.
George |
|
#7
|
|||
|
|||
|
Do you have a “SystemReport” download link?
I need to find out, what a MemBuf is. Thanks Christian |
|
#8
|
|||
|
|||
|
MemBuf: TDBMemoBuf;
ReportSystem are components which from the Rave system which is now a part of Delphi 7. You can find out about Rave at www.nevrona.com. They have always been helpful. George |
![]() |
| Thread Tools | |
| Display Modes | |
|
|