Page 1 of 1

Copy RVData from one in another RichView Component

Posted: Thu Dec 06, 2007 3:24 pm
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

Posted: Fri Dec 07, 2007 12:47 pm
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

Posted: Fri Dec 07, 2007 2:20 pm
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

Re: Copy RVData from one in another RichView Component

Posted: Sun Dec 09, 2007 5:14 pm
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;

Posted: Mon Dec 10, 2007 8:04 am
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

Posted: Mon Dec 10, 2007 1:45 pm
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?

Posted: Mon Dec 10, 2007 2:36 pm
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

Posted: Mon Dec 10, 2007 4:33 pm
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.