Plain Text Bullets on Copy
Plain Text Bullets on Copy
Hi Sergey,
Is there any way to copy bullets from an rve doc and get them to paste into plain text with some sort of markers still there? Or is there some way to get the marker text (bullet or number) from list items?
Thanks Sergey
Stan
Is there any way to copy bullets from an rve doc and get them to paste into plain text with some sort of markers still there? Or is there some way to get the marker text (bullet or number) from list items?
Thanks Sergey
Stan
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Plain Text Bullets on Copy
1. Currently, this behavior is hard-coded. TRichView copies the result of GetSelTextW method to the Clipboard, this method internally calls SaveTextToStreamW with the parameter TextOnly = True. With this option, content of most non-text items is not stored, including list markers.
Now I think that excluding the list markers is not a good idea, so it will be changed in the next update.
Quick fix: in RVMarker.pas, change TRVMarkerItemInfo.GetBoolValue to:
2. Getting visible text from marker is possible, but not documented.
(rv.GetItem(ItemNo) as TRVListMarkerInfo).DisplayString
Now I think that excluding the list markers is not a good idea, so it will be changed in the next update.
Quick fix: in RVMarker.pas, change TRVMarkerItemInfo.GetBoolValue to:
Code: Select all
function TRVMarkerItemInfo.GetBoolValue(Prop: TRVItemBoolProperty): Boolean;
begin
case Prop of
rvbpDrawingChangesFont, rvbpDocXOnlyBeforeAfter, rvbpAlwaysInText:
Result := True;
else
Result := inherited GetBoolValue(Prop);
end;
end;
(rv.GetItem(ItemNo) as TRVListMarkerInfo).DisplayString
Re: Plain Text Bullets on Copy
Hi Sergey,
I tried both options and both worked. Using option 2 I was able to process selected text indents as well in my own code.
Would it eventually be possible to add processing the indents when copying text (to use as plain text) in general? I'm not sure about the overall implications of this but thought I'd mention it.
Thanks for this information. It helps, especially with numbered lists.
Stan
I tried both options and both worked. Using option 2 I was able to process selected text indents as well in my own code.
Would it eventually be possible to add processing the indents when copying text (to use as plain text) in general? I'm not sure about the overall implications of this but thought I'd mention it.
Thanks for this information. It helps, especially with numbered lists.
Stan
Re: Plain Text Bullets on Copy
Unfortunately since "bullets" are included but not selected this causes many problems and produces unexpected results
For example
If one searches for <slf> in the following.
For example
If one searches for <slf> in the following.
- <slf>text</slf>
Last edited by jgkoehn on Fri Oct 06, 2023 8:45 pm, edited 1 time in total.
Re: Plain Text Bullets on Copy
Please restore original functionality and allow users to add bullets if they so desire by something such as.
GetSelTextW(TextOnly: Boolean = True);
Since bullets are not technically text.
GetSelTextW(TextOnly: Boolean = True);
Since bullets are not technically text.
Re: Plain Text Bullets on Copy
Or if the above is not possible/preferrable please help me find a workable solution that I can use and not have bullets included unless they are specifically selected.
I understand if I was searching for <slf> in <slf> bullet text </slf> but when it is bullet <slf> and still gets the bullet it does not seem right. Perhaps I am misunderstanding something
In this scenario I only selected the word "test" the line is bullet space test so there should be a division
But I got this when debugging.
I understand if I was searching for <slf> in <slf> bullet text </slf> but when it is bullet <slf> and still gets the bullet it does not seem right. Perhaps I am misunderstanding something
In this scenario I only selected the word "test" the line is bullet space test so there should be a division
But I got this when debugging.
Re: Plain Text Bullets on Copy
I went in and added:
IncludeListItemsAsText This may not be the best but works for now.
IncludeListItemsAsText This may not be the best but works for now.
Code: Select all
if SelectionOnly AND IncludeListItemsAsText then
begin
MarkerItemNo := GetFirstParaSectionItem(StartItemNo);
if (GetItemStyle(MarkerItemNo) = rvsListMarker) then
begin
s := GetNonTextStr(MarkerItemNo, 0, 1, CustomSave);
RVFWriteW(Stream, GetStr(GetItem(MarkerItemNo), s, CustomSave));
end;
end;
Re: Plain Text Bullets on Copy
To help solve this would it be possible to make it so List Items could be selectable?
That way if they were not selected they would not be included.
That way if they were not selected they would not be included.
Re: Plain Text Bullets on Copy
Sergey,
I'm OK using
So whatever you work out won't cause any problems for me.
Stan
I'm OK using
Code: Select all
(rv.GetItem(ItemNo) as TRVListMarkerInfo).DisplayString
Stan
Re: Plain Text Bullets on Copy
I could see the benefit of having it included in the text but also only if it is actually selected. Right now it seems to be starting at the list item even if the select starts later in the line.
Re: Plain Text Bullets on Copy
I looked at Word and Libreoffice. Both allow selecting bullets separately from text. That makes it easy to change bullet color independently from the text. Both allow an alt+left mouse button to select text separately from bullets. If you do that in Libreoffice and copy it, you still get the bullets. In Word you get just the text. If you select bulleted text as a whole, in Libreoffice you get the bullets but no indents included, in Word you get bullets and indents. So that's how those 2 handle bullets.
In the case of the rve component, something like this might work:
Code: Select all
GetSelTextW( IncludeMarkers: boolean = false; IncludeIndents: boolean = false );
Code: Select all
rve.GetSelTextW; //as it is now, text only, no markers, no indents in copied text
rve.GetSelTextW( true ); //markers included, no indents in copied text
rve.GetSelTextW( false, true ); //no markers, indents included in copied text
rve.GetSelTextW( true, true ); /both markers and indents included in copied text
Stan
Re: Plain Text Bullets on Copy
I think that would be a good solution.
I agree if somehow the list marker could be select so as to change its color that would be beneficial. While also allowing to keep the text seperate.
I agree if somehow the list marker could be select so as to change its color that would be beneficial. While also allowing to keep the text seperate.
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Plain Text Bullets on Copy
Probably it will be implemented in future, but this feature requires a lot of work.
First, this is a very special selection. List markers cannot be included in normal selection, they can be selected only separately from other content.
Next, all markers of the same level must be selected at the same time.
Next, this feature makes sense only if operations changing certain font properties of selected list markers will be implemented.
First, this is a very special selection. List markers cannot be included in normal selection, they can be selected only separately from other content.
Next, all markers of the same level must be selected at the same time.
Next, this feature makes sense only if operations changing certain font properties of selected list markers will be implemented.
Re: Plain Text Bullets on Copy
That makes sense.
How can it temporarily be fixed since this at present with now including the listmarkers breaks a lot of code? "I can implement my work around" but it doesn't really solve it if it just gets overwritten. Plus the listmarker is not really part of the selected text but outside of it.
How can it temporarily be fixed since this at present with now including the listmarkers breaks a lot of code? "I can implement my work around" but it doesn't really solve it if it just gets overwritten. Plus the listmarker is not really part of the selected text but outside of it.
Re: Plain Text Bullets on Copy
Since this will take work to implement how can one take list markers back out of GetSelText without modifying TRichView code?