Using Rave

Beatnik on 2003-10-13T12:16:29

Well, this is totally off-topic but this is my blog and I do as I well please!

unit Unit1;

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RpDefine, RpRave, StdCtrls, RVClass, RVProj, RVCsStd, RpBase, RpFiler, RpSystem, RpRender, RpRenderCanvas, RpCon;

type
TForm1 = class(TForm)
RvProject1: TRvProject;
RvNDRWriter1: TRvNDRWriter;
RvSystem1: TRvSystem;
Button2 : TButton;
procedure Button2Click(Sender: TObject);
private
public
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var
MyPage: TRavePage;
MyText: TRaveText;
begin
RvProject1.Open;
With RvProject1.ProjMan do begin
MyPage := FindRaveComponent('Report1.Page1',nil) as TRavePage;
MyText := FindRaveComponent('Text1',MyPage) as TRaveText;
MyText.Text := 'Some Text';
end;
RvProject1.ExecuteReport('Report1');
RvProject1.Close;
end;

end.


With my resource described as follows

object Form1: TForm1
Left = 247
Top = 174
Width = 119
Height = 69
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button2: TButton
Left = 8
Top = 8
Width = 89
Height = 25
Caption = 'Click'
TabOrder = 0
OnClick = Button2Click
end
object RvProject1: TRvProject
Engine = RvSystem1
ProjectFile = 'Project1.rav'
Left = 40
Top = 8
end
object RvNDRWriter1: TRvNDRWriter
StatusFormat = 'Printing page %p'
UnitsFactor = 1.000000000000000000
Title = 'momo'
Orientation = poPortrait
ScaleX = 100.000000000000000000
ScaleY = 100.000000000000000000
Left = 8
Top = 8
end
object RvSystem1: TRvSystem
TitleSetup = 'Output Options'
TitleStatus = 'Report Status'
TitlePreview = 'Report Preview'
SystemSetups = [ssAllowCopies,
ssAllowCollate, ssAllowDuplex,
ssAllowDestPrinter, ssAllowDestFile,
ssAllowPrinterSetup]
SystemOptions = [soShowStatus, soPreviewModal]
SystemFiler.StatusFormat = 'Generating page %p'
SystemPreview.MarginPercent = 5.000000000000000000
SystemPreview.ZoomFactor = 100.000000000000000000
SystemPrinter.ScaleX = 100.000000000000000000
SystemPrinter.ScaleY = 100.000000000000000000
SystemPrinter.StatusFormat = 'Printing page %p'
SystemPrinter.Title = 'ReportPrinter Report'
SystemPrinter.UnitsFactor = 1.000000000000000000
Left = 72
Top = 8
end
end

Delphi is smart enough to understand what this all means. I just love smart languages.. unlike perl (which is all line noise anyway).

Confucius say: Man who speaks smart language is often dumb, man who speaks dumb language is often smart.