Hi,
I wanna know how can i get the item number before each line/paragraph break in RVE.
im going to find words which have a space after and also the last word of lines which has a line/parag break after.
for example:
Hello world<LB>
Sup there?
the function should returns:
"Hello", "World" and "Sup"
How to Get Line/Paragraph Breaks
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
First, about document structure that does not depend on word wrapping.
Document consists of items, numbered from 0 to ItemCount-1.
The type of item returned by GetItemStyle(i), the text for text items is returned by GetItemText(i).
If the item starts a new paragraph, GetItemPara(i)=True.
If the item starts a line inside a paragraph (for example, added with Shift+Enter), GetItemPara(i)=False, but IsFromNewLine(i)=True.
About line wrapping. This information is not documented.
Line wrapping depend on window width.
There is a collection of drawing items: RichView.RVData.DrawItems. Each object represents an object on the screen. For non-text objects, one drawing item correspond to one item. For text items, one drawing object is created for each line (but for justify alignment, one drawing object is created for each word). Hidden items do not have corresponding drawing items.
Item in RVData.DrawItems have the following properties:
ItemNo - index of the corresponding item
Offs - for text items, index of the first character of text in GetItemText(ItemNo), from 1
Length - length of text belonging to this drawing item.
FromNewLine - true if this drawing items starts a new line (does not matter why, because of paragraph break or because of line wrapping).
Note that drawing items may not cover the whole range of text of item: in place of line breaks, space character may be omitted.
This information is enough to calculate line break positions.
Document consists of items, numbered from 0 to ItemCount-1.
The type of item returned by GetItemStyle(i), the text for text items is returned by GetItemText(i).
If the item starts a new paragraph, GetItemPara(i)=True.
If the item starts a line inside a paragraph (for example, added with Shift+Enter), GetItemPara(i)=False, but IsFromNewLine(i)=True.
About line wrapping. This information is not documented.
Line wrapping depend on window width.
There is a collection of drawing items: RichView.RVData.DrawItems. Each object represents an object on the screen. For non-text objects, one drawing item correspond to one item. For text items, one drawing object is created for each line (but for justify alignment, one drawing object is created for each word). Hidden items do not have corresponding drawing items.
Item in RVData.DrawItems have the following properties:
ItemNo - index of the corresponding item
Offs - for text items, index of the first character of text in GetItemText(ItemNo), from 1
Length - length of text belonging to this drawing item.
FromNewLine - true if this drawing items starts a new line (does not matter why, because of paragraph break or because of line wrapping).
Note that drawing items may not cover the whole range of text of item: in place of line breaks, space character may be omitted.
This information is enough to calculate line break positions.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: