Mittwoch, 7. Januar 2009

Rave and the old preview...

Rave have since version 3 the same preview-form. Many users of Rave don't understand why it's not with a newer design available. 
First the BEX users have the complete source and on the other side (for BE-users and corporate-design-developers) you have with Delphi and Rave all the flexibility you need for your own preview in your application-form, with your look&feel.

In the following example you see how easy an own preview in your form is:
You must only insert a TScrollBox from Delphi and instead of the RvSystem the RvNDRWriter for the engine of your RvProject. To render the report into the scrollBox you need the RvRenderPreview-component from the Rave-register;

you can insert the componenta on your form or create on runtime:
      RvRenderPreview1: TRvRenderPreview;
    RvNDRWriter1: TRvNDRWriter;
    RvRenderPreview1 := TRvRenderPreview.Create(Self);
    RvNDRWriter1 := TRvNDRWriter.Create(Self);

Now you can show the report inside your application and don't need a special (old) form ...

procedure TForm1.Button2Click(Sender: TObject);
var
  MeinNDRStream: TMemoryStream;
begin
  MeinNDRStream := TMemoryStream.Create;
  RvProject1.Open;
  RvProject1.Engine := RvNDRWriter1;
  with RvNDRWriter1 do
  begin
    StreamMode := smUser;
    Stream := MeinNDRStream;
  end;
  RvProject1.Execute;
  // the report is now written into the TMemoryStream;
  // you can use the report for many things without regenerate
  // the report again!
  // e.g. preview, print and render into PDF/HTML or whatelse

  MeinNDRStream.Position := 0;

  with RvRenderPreview1 do
  begin
    ScrollBox := ScrollBox1;
    NDRStream := MeinNDRStream;
    Render;
  end;

 MeinNDRStream.Position := 0;
// here I use the report again for rendering into a pdf-file
// without regenerate it again ...  
  RvRenderPDF1.PrintRender(MeinNDRStream,'c:\hello_world.pdf');
  // with RenderPage you can define a page and only 
  // this page is   rendered:
  RvRenderpdf1.RenderPage(1);
end;

To navigate in your report you have the following possibilities:

  RvRenderPreview1.PrevPage;
  RvRenderPreview1.NextPage;
  RvRenderPreview1.LastPage := RvRenderPreview1.Pages;
  RvRenderPreview1.FirstPage := 0;

Here you get the total pages outside Rave:
    RvRenderPreview1.Pages


Kommentare:

Joe Trap hat gesagt…

Since you seem very familar with RAVE, I have a question.

Is it possible to load a preexisting PDF file and Print it (setting the paper size, printer, and orientation) through using any RAVE components?

thomas pfister hat gesagt…

Joe,
sorry, this isn't available, but I can recommend the new PDFToolkit from gnostice.com. There is this possible.

melphis hat gesagt…

Thomas, thank for you for exists, I love you!!!!!

michaxx hat gesagt…

Hello,

what would be the best way to implement a print function in a custom preview form?

rvRenderPrinter.Render(MeinNDRStream);
prints it, but several questions would be still open, e.g. printer selection, or printing only page 1...
Yours
Michael Bickel

Anonym hat gesagt…

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic

Anonym hat gesagt…
Der Kommentar wurde von einem Blog-Administrator entfernt.
Anonym hat gesagt…

I'm from Brazil,
and come with this little note congratulating you looked all over the internet on Rave and only succeeded in showing you a simple way what I needed, I am poor have few resources (money) and I'm learning to program because of people like you and with the help of God, I am very grateful that you would give me a hand one way forward, parameters, so that I can develop further, something like handouts, tips, tricks. Something that makes me Evolve, Thanks Again!

Let me give my email to contact rodolfod2r2@gmail.com

Anonym hat gesagt…

Very nicce!

Anonym hat gesagt…

When is the data selected that needs to print to pdf?