Hi,
I copy to clipboard an RVF text included a protection : [rvprStyleProtect, rvprModifyProtect, rvprDeleteProtect, rvprSticking, rvprStickToTop, rvprDoNotAutoSwitch]
Is it possible to remove the protection included in RVF Text on pasting?
Best regards
Marius
Paste without protection
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The current version does not have an option for this.
You can paste in a hidden editor, modify its text styles, then insert to the main editor. You can use OnPaste event.
You can paste in a hidden editor, modify its text styles, then insert to the main editor. You can use OnPaste event.
Code: Select all
procedure TMyForm.MainEditorPaste(Sender: TCustomRichViewEdit;
var DoDefault: Boolean);
begin
if not hiddeneditor.CanPasteRVF then
exit;
hiddeneditor.Clear;
hiddeneditor.DeleteUnusedStyles(True, True, True);
hiddeneditor.Format;
hiddeneditor.Paste;
for i := 0 to hiddeneditor.Style.TextStyles.Count-1 do
hiddeneditor.Style.TextStyles[i].Protection := [];
Stream := TMemoryStream.Create;
try
hiddeneditor.SaveRVFToStream(Stream, False);
Stream.Position := 0;
maineditor.InsertRVFFromStreamEd(Stream);
finally
Stream.Free;
end;
DoDefault := False;
end;