开发者

Set a "TEXT" in Rave Report to a Edit1.text on a Delphi form when printing

Is there a way to set a certain text like text1 on a Rave Report to a certain Edit.text on a Delphi form you print from in your Delphi application. I want to create an application form in a delphi application where each block represents a certain letter of a word... for example - Ed开发者_开发问答it1.text := Surname On my Rave Report text1 should show Edit1.text[1] (S), text2 should show Edit1.text[2] (u) ... and so forth. I know how to use the datatext function in Rave Report... but that would mean I have to save each letter of each field in a database column separately first... :( Please help me if you can... coz I'm very stupid when it comes to this sort of thing.


Since this looks quite strange for me and I would strongly consider to set your TEdit.Text directly from your application not from the report and since it's not quite clear what you are asking here I'll try to show you how to get or set the text from or to the Text component in Rave Reports.

Let's pretend you have the Report1 with Page1 where the text component named Text1 is placed somewhere. All of this is by Rave Reports designer saved in the C:\YourRaveProject.rav file. Then assume you have in your Delphi project a button with the following code in its OnClick event handler and two edit boxes, Edit1, where we load the text from our Text1 component and Edit2 from which we set our Text1 component text.

uses
  RpRave, RpDefine, RpBase, RpSystem, RvCsStd;

procedure TForm1.Button1Click(Sender: TObject);
var
  RaveProject: TRvProject;
begin
  RaveProject := TRvProject.Create(nil);
  RaveProject.ProjectFile := 'C:\YourRaveProject.rav';

  try
    RaveProject.Open;
    RaveProject.SelectReport('Report1', False);
    // get the text from the Text1 component from the report
    Edit1.Text := (RaveProject.ProjMan.FindRaveComponent('Page1.Text1', nil) as TRaveText).Text;
    // set the text of the Text1 component on the report
    (RaveProject.ProjMan.FindRaveComponent('Page1.Text1', nil) as TRaveText).Text := Edit2.Text;
    // and execute the report for showing the result of setting the text
    // note, this can be omitted of course if you want only to get the value
    RaveProject.ExecuteReport('Report1');
    RaveProject.Close;

  finally
    RaveProject.Free;
  end;
end;

Please, take this as an example, not as a real answer to your question because IMHO it's unanswerable at this time. If you specify the exact question then we might be able to help you with your real problem.

Tested on Delphi 2009 with Rave Reports 7.6.2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜