Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting RichEdit paragraphs

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
0
0
How would I go about counting the paragraphs\sentences in a RichEdit? Cyprus
 
TCustomRichEdit::paragraph
Specifies the formatting information for the current paragraphs.

__property TParaAttributes* Paragraph = {read=FParagraph};

Description

Read Paragraph to get the TParaAttributes object used by the rich edit control to specify paragraph formatting information. Use the TParaAttributes object to read or write the paragraph formatting information for the current paragraphs. Paragraph formatting information includes alignment, indentation, numbering, and tabs.

Paragraph is a read-only property, because a TCustomRichEdit object has only one TParaAttributes object, which cannot be changed. The attributes of the current paragraphs, however, can be changed, by setting the properties of the TParaAttributes object. These can be set one by one, or all can be set to the value of an existing TParaAttributes object by using Paragraph->Assign.

The current paragraphs are the paragraphs that contain the selected text. If no text is selected, the current paragraph is the one containing the cursor.

Note: Paragraph is available only at runtime.

Example:
This example requires only a form.
A Rich Edit control is created on the form and aligned to take the entire client area of the form. A series of lines are written to the Rich Edit control's Lines property, and the Paragraph property manipulated such that the first items displayed are bulleted, a second group of lines are unbulleted and centered, and the last group is left justified and indented.

#include <ComCtrls.hpp>;

void __fastcall TForm1::FormCreate(TObject *Sender)
{
TRichEdit *pRich = new TRichEdit(this);
pRich->Parent = this;
pRich->Align = alClient;
pRich->Lines->Clear();
// set numbering style
pRich->Paragraph->Numbering = nsBullet;
pRich->Lines->Add(&quot;Introduction&quot;);
pRich->Lines->Add(&quot;New members to our team&quot;);
pRich->Lines->Add(&quot;New Budget discussion&quot;);
pRich->Lines->Add(&quot;Facilities&quot;);
pRich->Lines->Add(&quot;Q & A&quot;);

pRich->Paragraph->Numbering = nsNone;
pRich->Paragraph->Alignment = taCenter;
pRich->Lines->Add(&quot;&quot;);
pRich->Lines->Add(&quot;Suggested Topics: &quot;);
pRich->Lines->Add(&quot;&quot;);
pRich->Paragraph->Alignment = taLeftJustify;
pRich->Paragraph->FirstIndent = 10;
pRich->Lines->Add(&quot;&quot;);
pRich->Lines->Add(&quot;Parking lot repair&quot;);
pRich->Lines->Add(&quot;Cost overruns&quot;);
}
 
Hi i have to count number of paragraphs in a story.can anyone suggest any code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top