Page 1 of 1
Paste without protection
Posted: Mon Feb 03, 2014 1:26 pm
by Marcer
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
Posted: Mon Feb 03, 2014 6:38 pm
by Sergey Tkachenko
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.
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;
Posted: Mon Feb 03, 2014 7:37 pm
by Marcer
Thanks Sergey!! It's functionnal!!
Best regards!!
Marius