Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2003, 04:46 AM
cs cs is offline
Senior Member
 
Join Date: Feb 2001
Posts: 260
Default How to print a memo text

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
Reply With Quote
  #2  
Old 12-19-2003, 06:43 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 832
Default RE: How to print a memo text

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
Reply With Quote
  #3  
Old 12-19-2003, 08:48 AM
nikolayj nikolayj is offline
Senior Member
 
Join Date: May 2002
Posts: 335
Default RE: How to print a memo text

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;
Click Accept if helped
Reply With Quote
  #4  
Old 12-19-2003, 08:55 AM
cs cs is offline
Senior Member
 
Join Date: Feb 2001
Posts: 260
Default RE: How to print a memo text

Thanks for your answer.
Do you have any solution, without using this component.
Reply With Quote
  #5  
Old 12-19-2003, 09:00 AM
cs cs is offline
Senior Member
 
Join Date: Feb 2001
Posts: 260
Default RE: How to print a memo text

Sorry, but I can't use this example.
You code will cut the lines, if the text is to long.
Reply With Quote
  #6  
Old 12-19-2003, 09:39 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 832
Default RE: How to print a memo text

I think that is what MemBuf.NoCRLF := False; is for. I don't have any broken line problem.

George
Reply With Quote
  #7  
Old 12-20-2003, 04:18 AM
cs cs is offline
Senior Member
 
Join Date: Feb 2001
Posts: 260
Default RE: How to print a memo text

Do you have a “SystemReport” download link?
I need to find out, what a MemBuf is.

Thanks
Christian
Reply With Quote
  #8  
Old 12-20-2003, 05:38 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 832
Default RE: How to print a memo text

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 04:24 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2014, vBulletin Solutions, Inc.