Board index » delphi » Printing Tmemofield

Printing Tmemofield

Delphi 1.0

How do I print the contents of a TMemofield? I would like to be able to
format it and control the placement of the memo on a page.

Using a TBlobStream and converting it to a TStringList seems to lose the
data if the line is longer than 255 characters.

Thanks.

 

Re:Printing Tmemofield


Steven,

instead of using a TStringlist you can use a TMemo to format the lines. The
key here is to bypass Memo.Lines and use SetTextBuf instead to load the
memo in one fell swoop from a zero-terminated string. So you do something
like this:

 Var
   pBuf: PChar;
   bufsize: Integer;

   bufsize := blobstream.size;
   pBuf :=StrAlloc( bufsize+1 );
   try
     blobstream.read( pBuf^, bufsize );
     pBuf[ bufsize ] := #0;
     memo1.SetTextBuf( pBuf );
   finally  
     StrDispose( pBuf );
   end;  

The memo can be hidden.  

Peter Below (TeamB)  100113.1...@compuserve.com)

Re:Printing Tmemofield


OK. That was easy.

1.) The TMemo formats the lines now I have to grab the individual text
rows. How do I tell how many rows of text there are? I want to be able to
know ahead of time if the TMemoField  will need more than one page and at
what postion it will stop at.

Am using a TRect.

Thank you.

Peter Below <100113.1...@compuserve.com> wrote in article
<VA.00000e1a.00e1c99a@noname>...

Quote
> Steven,

> instead of using a TStringlist you can use a TMemo to format the lines.
The
> key here is to bypass Memo.Lines and use SetTextBuf instead to load the
> memo in one fell swoop from a zero-terminated string.

...
.  
Quote

> Peter Below (TeamB)  100113.1...@compuserve.com)

Re:Printing Tmemofield


Steven,

memo.lines.count returns the number of lines in the memo.

Peter Below (TeamB)  100113.1...@compuserve.com)

Other Threads