Copy/Paste between two RichViewEdit and double list styles

General TRichView support forum. Please post your questions here
Post Reply
DmitriPopov
Posts: 29
Joined: Tue Dec 15, 2009 10:01 am

Copy/Paste between two RichViewEdit and double list styles

Post by DmitriPopov »

Hello!

I am using TRichView TRichView: 12.6.1 in Delphi 2010

I encountered strange problem with copy/paste between two TRichViewEdit components.

Both RVedits have their own RVStyle components attached. Initially contents of RVEdits and RVStyles are identical (some text and numbered list). Now let's copy a portion of text (not even portion of list) from RVEdit1 into RVEdit2 (I use Ctrl+Ins/Shift+Ins keys). After that RVStyle attached to RVEdit2 contains two duplicate ListStyles of which only one is actually used. Why is that so? I didn't even copy list, only text.

DeleteUnusedStyles removes excessive styles but I cannot use it because it will also remove styles that are in RVStyle2, are unused but stull required by the application.

Two more notes:
1. Text in RVedits is from MS Word received by copy/paste.
2. There can be two ways to prepare initial state of RVEdits. The problem appears only when I consequently paste text from Word into RVEdit1 and RVEdit2. If I first paste text into RVEdit1 and then copy/paste it from RVEdit1 into RVEdit2 no problem appears. After both operations styles seem identical so I cannot understand why in the first case list styles become doubled after another copy/paste operation.

If there's a way to instruct DeleteUnusedStyles not to delete some styles that are unused but required the problem will be solved partially.
DmitriPopov
Posts: 29
Joined: Tue Dec 15, 2009 10:01 am

Post by DmitriPopov »

I just managed to control DeleteUnusedStyles by setting "Standard" to True for styles I want to keep. But it solved the problem only partially.

Now styles don't multiply when I copy text from RVedit1 to RVEdit2 but they do when I copy list. This is very strange since RVStyle2 already contains list style that perfectly matches the one being copied. Resulting contents of RVEdit2 reference newly added style instead of the one that already existed so DeleteUnusedStyles won't work.
Sergey Tkachenko
Site Admin
Posts: 17291
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, there is a difference in copying identical list styles from the same editor or from another editor. When copying from another editor, TRichViewEdit treats the pasted lists as different from its own lists. It is implemented by assigning unique identifier to list styles.

May be this is not an ideal solution, but I think that non-distinguishing lists would be worse (for numbered list styles).

It does not matter if the pasted fragment contains list markers or not: when pasting RVF, all styles are merged, even unused styles.
DmitriPopov
Posts: 29
Joined: Tue Dec 15, 2009 10:01 am

Post by DmitriPopov »

I think there should be an option that defines the way copy/paste work with styles - work by default, or by user-defined behavior, possibly via event handling.

In my case users do copy/paste excessively and this leads to a huge style and slow operation.
Post Reply