quantity of paragraphes in RichEdit

Please discuss general Delphi programming topics here.

quantity of paragraphes in RichEdit

Postby N.Y.P.D. » June 5th, 2006, 5:08 am

How to get quantity of paragraphes in Delphi RichEdit. Or When I walk through the rows of RichEdit, how to detect that I jump from one paragraph to another one.
I mean:
Code: Select all
var
    s : String;
for i := 0 to ARichEdit.Lines.Count - 1 do  // walking through the rows
begin
    s := ARichEdit.Lines[i]; // Here ARichEdit.Lines[i] belongs to   
                                      //           paragraph   number 5, for exaple;
            // How to detect that ARichEdit.Lines[i + 1] will 
                                      //           belong to paragraph number 6???

 end;
N.Y.P.D.
N.Y.P.D.
Active Member
Active Member
 
Posts: 13
Joined: May 15th, 2006, 1:14 pm
Location: Russia Tver

Postby kokkoras » June 5th, 2006, 10:22 am

Have you tried to detect the #10#13 (or it is #13#10) combination on chars? These are the line feed and carriage return symbols uded to designate a paragraph change.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby N.Y.P.D. » June 5th, 2006, 12:06 pm

kokkoras wrote:Have you tried to detect the #10#13 (or it is #13#10) combination on chars? These are the line feed and carriage return symbols uded to designate a paragraph change.

There is no such
#10#13 (or it is #13#10) combination on chars in ARichEdit.Lines[row]. It does not contained even in whole paragraph and text, if text read from one row to another. In RichEdit next paragraph detected somehow magestic, but I don't know how.
N.Y.P.D.
N.Y.P.D.
Active Member
Active Member
 
Posts: 13
Joined: May 15th, 2006, 1:14 pm
Location: Russia Tver

Postby Kambiz » June 5th, 2006, 4:28 pm

An empty line (e.g. RichEdit.Lines[index]) indicates the paragraph boundary.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2421
Joined: March 7th, 2003, 7:10 pm

paragraph boundary

Postby N.Y.P.D. » June 9th, 2006, 7:04 am

Kambiz wrote:An empty line (e.g. RichEdit.Lines[index]) indicates the paragraph boundary.

You mean RichEdit.Lines[index]='', when you saing "empty line"? If so, then empty line doesn't indicates paragraph boundary. I checked it. A text can have a lot of boundaries and don't contain empty line.
N.Y.P.D.
N.Y.P.D.
Active Member
Active Member
 
Posts: 13
Joined: May 15th, 2006, 1:14 pm
Location: Russia Tver

Re: paragraph boundary

Postby kokkoras » June 9th, 2006, 1:53 pm

N.Y.P.D. wrote:
Kambiz wrote:An empty line (e.g. RichEdit.Lines[index]) indicates the paragraph boundary.

You mean RichEdit.Lines[index]='', when you saing "empty line"? If so, then empty line doesn't indicates paragraph boundary. I checked it. A text can have a lot of boundaries and don't contain empty line.


Officialy, change of paragraph is LF+CR (line feed + carriage return). If this is not the case then change of paragraph should be considered whatever you like. Usually, in plain text content, it is the empty line. In plain text there is still LF+CR but you may choose to use the empty line which is quite common. You can detect the empty line by reading the content of a line and count the mumber of chars in it.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Re: paragraph boundary

Postby N.Y.P.D. » June 13th, 2006, 5:20 am

kokkoras wrote:
N.Y.P.D. wrote:
Kambiz wrote:An empty line (e.g. RichEdit.Lines[index]) indicates the paragraph boundary.

You mean RichEdit.Lines[index]='', when you saing "empty line"? If so, then empty line doesn't indicates paragraph boundary. I checked it. A text can have a lot of boundaries and don't contain empty line.


Officialy, change of paragraph is LF+CR (line feed + carriage return). If this is not the case then change of paragraph should be considered whatever you like. Usually, in plain text content, it is the empty line. In plain text there is still LF+CR but you may choose to use the empty line which is quite common. You can detect the empty line by reading the content of a line and count the mumber of chars in it.

In my case ARichEdit.PlainText := false, because I open there RTF and DOC files. How to detect paragraph boundary here?
N.Y.P.D.
N.Y.P.D.
Active Member
Active Member
 
Posts: 13
Joined: May 15th, 2006, 1:14 pm
Location: Russia Tver

Postby kokkoras » June 13th, 2006, 6:03 am

Try parsing a small example of your content, char-by-char, to see the ASCII codes used at the point you asume a paragraph change.
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece


Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron