Copy RVData from one in another RichView Component

General TRichView support forum. Please post your questions here
Post Reply
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Copy RVData from one in another RichView Component

Post by BernhardRoos »

Hello,
how can I programmatical copy the RVData to another RichView Component.
I've tried it to save it to a stream and load this stream in the second RichView. But if there are PageBreaks all after the first PageBreak is gone.
How can I solve the problem.
Best wishes
Bernhard
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Now I can better explain what my problem is. In the meanwhile I found a method to copy the RichText.


ppSicherRV.RichView.Clear;
ppSicherRV.RichView.AppendForm(ppRV.RichView);

... Do something with ppRV.RichView ...

ppRV.RichView.Clear;
ppRV.RichView.AppendFrom(ppSicherRV.RichView);

If I do so then the second page is empty. But the RichView has a second page (hard page break).

Best wishes
Bernhard
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

One further information.
I do this in the OnPrint Event of tppRichView.

The same happens if I try in the OnPrint Event to load a RV-File (which has more than one page).
The first page is then ok, the second page is empty.

I'm at the end with my wisdom. Please help me. What is to do after appending or loading the RVData?

Best wishes
Bernhard
Yernar Shambayev
Posts: 57
Joined: Wed Aug 31, 2005 6:46 pm

Re: Copy RVData from one in another RichView Component

Post by Yernar Shambayev »

BernhardRoos wrote:Hello,
how can I programmatical copy the RVData to another RichView Component.

Code: Select all

  MemStream := TMemoryStream.Create;
  try
    rv.SaveRVFToStream(MemStream, False);
    MemStream.Position := 0;
    RichViewEdit1.LoadRVFFromStream(MemStream);
  finally
    MemStream.Free;
  end;
  RichViewEdit1.Format;
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Thanks for your answer. But this is that what I did. And then I have exactly the problems which I've written in my first posting.
Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

AppendFrom is bad because it cannot copy some items (for example tables and controls).
So the best solution is to copy via RVF stream.
Page breaks must be retained. Can you tell me how to reproduce the problem?
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Thanks for your answer.
I've tried now with a Stream. This works fine.
What means "Pagebreaks must be retained". Can you give me an example?
Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I meant that all document attributes must be copied (when using the code from the Yernar's post), including page breaks.
I do not understand why page breaks after the fist page breaks may be gone, it should not happen.
Post Reply