Re: Rave Reports viewing and saving

Posted by RussCAp12602 on April 16, 2008

In Reply to Rave Reports viewing and saving posted by Youri on April 15, 2008

Go here: htp://dn.codegear.com/article/30329

Download the example from CodeGear (near bottom of the article). Compile the project.

Set High Contrast Black theme. Run "raveexample.exe" and you will see what I am talking about.

Here is a portion of the code:

===========================================
type
TFormMain = class(TForm)
RvSystem: TRvSystem;
Button1: TButton;
rgReport: TRadioGroup;
procedure RvSystemPrint(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
procedure GetFolderInfo(const Folder: string; var NumberOfFiles,
NumberOfFolders, SizeOfFiles: Cardinal);
procedure EnumFolders(Folders : TStrings; const Dir : string);
procedure PrintSimpleReport(Report : TBaseReport);
procedure PrintTabularReport(Report : TBaseReport);
procedure PrintGraphicsReport(Report : TBaseReport);
public
{ Public declarations }
end;

var
FormMain: TFormMain;

implementation

{$R *.dfm}

procedure TFormMain.RvSystemPrint(Sender: TObject);
begin
case rgReport.ItemIndex of
0 : PrintSimpleReport(Sender as TBaseReport);
1 : PrintTabularReport(Sender as TBaseReport);
2 : PrintGraphicsReport(Sender as TBaseReport);
end;
end;

procedure TFormMain.Button1Click(Sender: TObject);
begin
RvSystem.Execute;
end;


procedure TFormMain.PrintGraphicsReport(Report: TBaseReport);
var
Bitmap : TBitmap;
begin
with Report do
begin
Canvas.Brush.Color := clGray;
Rectangle(0.3, 0.3, 4.7, 3.3);
SetFont('Arial', 15);
FontColor := clRed;
PrintXY(0.5,0.5, 'Just look at all the graphics!');
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('delphi.bmp');
PrintBitmap(3.5, 0.3, 1, 2, Bitmap);
PrintBitmap(1, 2, 2, 2, Bitmap);
Canvas.Pen.Color := clBlue;
Canvas.Brush.Bitmap := Bitmap;
Ellipse(5,0.3,6,3.3);
Ellipse(2,1,4,1.9);
finally
Bitmap.Free;
end;
Canvas.Pen.Color := clBlack;
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := clYellow;
Pie(0.7,0.7,1.7,1.7,1,1,1,2);
Canvas.Brush.Color := clGreen;
Pie(0.7,0.7,1.7,1.7,1,2,1,1);
end;
end;

===============================================

The RvSystem.Execute brings up a dialog box where you choose Print, Review, or Save. I have no clue where this component is located, so I cannot alter its Font.Color as far as I can determine.

The MainForm is okay, since it is created within the Delphi designer, which fortunately makes the correct Font.Color settings.

Also, I don't see how to determine whether the called report procedure can modify itself based on where the report is going: Screen, Printer, or File. Why would I want to do this? Because when the bitmap is put into the report, it is always based on pixels, which makes it way too small for the printer.

And yes, my best option for using Rave is to do code based actions.

However, if the only option I have for writing to a file is Rave's propriatary format, then I don't want to use it. It is way too limited in this area.

Related articles

       

Follow Ups