Changing memo's value before print
Hi!
I'd like to print on matrix printer, but i have to change some special hungarian characters after loading from database but, before printed on the dot printer to make readable my printed data.
I did the following:
function Csere (Mit : string) : String;
var I : integer;
begin
for I := 1 to length(Mit) do
case Mit of
'Å' : Mit := 'Å‘';
'Ű' : Mit := 'ű';
end;
Result := Mit;
end;
procedure Memo1OnBeforePrint(Sender: TfrxComponent);
begin
Memo1.Memo.Text := Csere(Memo1.Memo.Text);
end;
It's not working....
I try to place the call of 'Csere' function in Master data onBeforePrint event, but it isn't working too.
if I say in 'Csere' function Result := 'A', then it's working, I see the 'A' characters on the preview.
but if I say Result := IntToStr(Length(Mit)); then I see a wrong number (and same in all lines), for example 65, however the length of data is differnet in each line(from 1 to 10 chars).
It looks like when the onbeforeprint event is running not the correct data is in the Memo1.Memo.Text;
How can I solve this problem?
Thanks!
I'd like to print on matrix printer, but i have to change some special hungarian characters after loading from database but, before printed on the dot printer to make readable my printed data.
I did the following:
function Csere (Mit : string) : String;
var I : integer;
begin
for I := 1 to length(Mit) do
case Mit of
'Å' : Mit := 'Å‘';
'Ű' : Mit := 'ű';
end;
Result := Mit;
end;
procedure Memo1OnBeforePrint(Sender: TfrxComponent);
begin
Memo1.Memo.Text := Csere(Memo1.Memo.Text);
end;
It's not working....
I try to place the call of 'Csere' function in Master data onBeforePrint event, but it isn't working too.
if I say in 'Csere' function Result := 'A', then it's working, I see the 'A' characters on the preview.
but if I say Result := IntToStr(Length(Mit)); then I see a wrong number (and same in all lines), for example 65, however the length of data is differnet in each line(from 1 to 10 chars).
It looks like when the onbeforeprint event is running not the correct data is in the Memo1.Memo.Text;
How can I solve this problem?
Thanks!
Comments
Thanks, but it's not working too
Something else?
function Convert(Str:String):String;
var i:integer;
begin
for i:=0 to length(Str)-1 do
case Str of
'a': Str:= 'A';
'f': Str:= 'F';
end;
Result := Str;
end;
procedure Memo2OnBeforePrint(Sender: TfrxComponent);
begin
Memo2.Text:= Convert(Memo2.text);
end;
It is work!
How do you test it? With a 'fix' text in the memo1 or data from dataset?
I realised something. When I used 'fix' text for example: I hope this will be ok! then the function change the letters well, but when I'd like to read this text from database (firebird) memo1.text contains the 'dataset_name."field_name"' string, not the data from dataset, so I can't change anything....
How can I catch that time when the finally text is in the memo.text? Not in onbeforeprint event???
OnAfterData event.
but why?
Thank you Den, it works!
In the help about OnAfterData event:
"The name of the script routine that will be called after the object gets data."
In the help about OnBeforePrint event:
"The name of the script routine that will be called before the object is handled."