Help: Reading Memo field to a string with line feeds

Help: Reading Memo field to a string with line feeds

Post by Bob-o-Bo » Sun, 31 Dec 1899 09:00:00



I want to read the contents of a memo field
to a string and then display it using
Canvas.TextRect.  I want the displayed text
to go to a new line for each newline character in the
memo.  When I read the memo using

MyText := MTable.FieldByName('MemoField').AsString,

and I display it with TextRect, I get little rectangles where
the line feed characters go.  How can I read the memo
and display it with the proper line feed display?

--
Bob-o-Bob
Delphi and MFC Programming

The opinions expressed by Bob are in no way
supported by his parents.

 
 
 

Help: Reading Memo field to a string with line feeds

Post by JJ » Sun, 31 Dec 1899 09:00:00



> MyText := MTable.FieldByName('MemoField').AsString,

> and I display it with TextRect, I get little rectangles where
> the line feed characters go.  How can I read the memo
> and display it with the proper line feed display?

Use API-call DrawText instead:  DrawText(Canvas.Handle, PChar(MyText),
Length(MyText), MyRect, 0);

And make sure that there are no #13 in your string. (Leave #10 if there
is any).

/// John

 
 
 

Help: Reading Memo field to a string with line feeds

Post by Ken » Sun, 31 Dec 1899 09:00:00


Try this:
MyText :=AdjustLineBreaks( MTable.FieldByName('MemoField').AsString);

Ken Z.

===================================


>I want to read the contents of a memo field
>to a string and then display it using
>Canvas.TextRect.  I want the displayed text
>to go to a new line for each newline character in the
>memo.  When I read the memo using

>MyText := MTable.FieldByName('MemoField').AsString,

>and I display it with TextRect, I get little rectangles where
>the line feed characters go.  How can I read the memo
>and display it with the proper line feed display?

>--
>Bob-o-Bob
>Delphi and MFC Programming

>The opinions expressed by Bob are in no way
>supported by his parents.

 
 
 

1. Line Feeds in Memo Fields

Using VFP 3.0 I can cut and paste text with line feeds (or line breaks -
returns) into a Memo field. Can anyone tell me how I can import a text
file that contains returns to delimit multiple records, tabs to delimit
fields, but also has text containing line feeds that I want to end up in
one Memo field. In attempting an import VFP interprets the line feeds as
returns and therefore as record delimiters.

Thanks for any help anyone can give.

Elliot
--

Elliot J. Lefkowitz, Ph.D.
Director, Biological Computing Resource Facility
University of Alabama at Birmingham
Department of Microbiology

2. Y2k & stored procedures

3. Osql replaces line feed with carriage return + line feed

4. !US - Phoenix, AZ - Oracle Database Administrator

5. Webcompanion crashes FMPro 5v3

6. read lines from memo field VC++ example required

7. Business rules/ Functions with SQL Server

8. I'd like to add a line feed to a memo

9. How to Get Past a Line Feed character in Reading a Sequential ASCII File

10. Stored Procedures: Writing a Line Feed to a Text Field

11. Reading MEMO Fields: HELP!

12. Help needed: reading access 2000 memo fields