Copy text with list markers

General TRichView support forum. Please post your questions here
Post Reply
LadyOfWood
Posts: 68
Joined: Sat Aug 27, 2005 9:34 pm

Copy text with list markers

Post by LadyOfWood » Thu Aug 01, 2019 6:14 pm

I have a text with following structure:
<text item0>
<list marker1 (rvsListMarker)><text item2>
<list marker3 (rvsListMarker)><text item4>
<list marker5 (rvsListMarker)><text item6>

to copy a text item i used a following code, set selection (before item 2 (1 - for text item) and before item 3 (0 - for non-text).

Code: Select all

rve.SetSelectionBounds(2, 1, 3, 0);
rve.SaveRVFToStream(save_stream, true);
rve.Deselect;
But list markers (1 and 3) in this case is saved to rvf. I do not need them. What am i doing wrong?

Sergey Tkachenko
Site Admin
Posts: 14552
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Copy text with list markers

Post by Sergey Tkachenko » Fri Aug 02, 2019 6:40 am

TRichView needs to decide somehow, when to copy list markers.

In MS Word, list markers are copied when end-of-paragraph mark is selected (not an ideal intuitive solution too, because a list marker and an end-of-paragraph mark are at the opposite sides of paragraphs).
TRichView does not have selectable end-of-paragraph marks, so it needs another rule. It is simple: markers are copied if the beginning of paragraph (not necessary counting the marker itself) is included in the selection.

Maybe a better logic is possible, but I do not know it.

LadyOfWood
Posts: 68
Joined: Sat Aug 27, 2005 9:34 pm

Re: Copy text with list markers

Post by LadyOfWood » Fri Aug 02, 2019 6:49 pm

Is any way to select items without list markers? Or save needed part of document to stream?

Sergey Tkachenko
Site Admin
Posts: 14552
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Copy text with list markers

Post by Sergey Tkachenko » Sat Aug 03, 2019 4:11 pm

Markers are added automatically, if the beginning of this paragraph is included in the selection.
Sorry, there is no way to not-save it.
The only way is copying the selection to a temporary invisible TRichView, remove the markers, and then copy.

LadyOfWood
Posts: 68
Joined: Sat Aug 27, 2005 9:34 pm

Re: Copy text with list markers

Post by LadyOfWood » Thu Aug 08, 2019 4:22 pm

I used another solution, replace a list markers by a text items.

Post Reply