How to read text file to FR?
duf
Poland
I would like to read a text file eg test.txt to FR. Do I have the text file format. I mean do I have to read the text to a database or save to a file *. Xml in a certain template. What are the simplest ways to read in the text or *.xml file. I would like to load *.xml files to specific Memo in FR.
Comments
support@fast-report.com
instead of
http://www.youtube.com/watch?v=WZ3YdKpXpM8&lc
This example shows how to load the entire file into a single object Memo. And how to load to several objects Memo different words from a text file? Of course, how to extract words from a file is known to me. I mean just like these words to redirect to specific objects Memo. Thanks.
If you only plan to use a file that you're going to construct then have a look at TIniFile Class - you'll find there o lot of usefull functions.
If so then search this forum for pass variable.
Or something like that: Is it called walking on thin ice?
you can pass values into the report variables after the report is loaded and before calling showreport or prepare report or you can use the findobjectmethod and pass it to the memo, or you can use the ongetvalue event
or you can use the onbeforeprint event of the tfrxreport component.
1 stripping the name of the memo and
2 you are not using the ogv event properly.
using the ogv event requires a variable with no set value to be placed in a memo using[] to denote an expression
that needs to be calculated ie, [myvar1] [myvar2]
the code for the ongetvalue event handler is triggered when ever these variables are encountered by the report engine. Your code will use the name of the variable not the memo.
here is a delphi sample you should be able to convert to c.
procedure TForm1.frxReport1GetValue(const VarName: String;
var Value: Variant);
begin
if CompareText(VarName, 'myvar1') = 0 then
Value := 'test';
if CompareText(VarName, 'myvar2') = 0 then
Value := 'test2'
end;