Ek RTF Report for Delphi
Version 3.06 (D5, D6, D7, D2005 Win32, D2006 Win32)

CONTENTS
1. Component description
2. History
3. License
4. Installation
5. Troubleshooting.
6. Contact information
1. COMPONENT DESCRIPTION
TEkRtf report is non visual component that allows you to use all power of MS Word or other rtf-compatible editor
to create, preview, edit and print your reports.
How to use it:
- create report template in MS Word
- save it in RTF format
- place TEkRTF component on form, fill required properties
- prepare data in your application
- run report using one of Execute methods
- run MS Word (or other editor) if you want to view, edit or print your document
For more information see help and demo application.
go top

2. HISTORY

Version 3.06
- frtf() function inside a table. Fixed bug when inserted text was outside of the table in some editors;
- Msftedit.dll rich text control. Fixed bug whith incorrect color table in output document;
- DataSet, which name is one char length, was parsed as not existing alias name.

Version 3.05
- frtf() function improved in order to be compatible with Word 2003 rtf documents.

Version 3.04
- Fixed bug with incorrect color table in ftrf() function, when report was executed for the second time;
- Optimized behaviour of iif function;
- Iif function may be used inside \Scan...\ commands;
- New keyword \elsif\:
\if(...)\
\elsif(...)\
\elsif(...)\
\else\
\endif\
- New assigment operator :=, for example \a:=4\;
- New function pos(substring, string) the same as Delphi pos function;
- New option eoKeepFrtfPar. If set to True, ftrf() format function doesn't delete paragraph symbol in inserted rtf text.

Version 3.01
- Optimized code to make faster report compilation;
- Page breaks are not ignored inside inserted rtf text;

Version 3.00
- Created DataType property for report variables;
Variables previously created in design time will have data type "Unknown";
- New design time editor for report variables;
- Decimal separator for numeric constants in report template set to ".";
- Arithmetical operations and formulas in report template:
>, <, =, <=, >=, <>, != (not equal), +, -, *, /, % (mod)
- Logical operations and formulas in report template:
&& (and), || (or), ! (not)
Built-in report functions:
SET(VarName, Value) assigns Value to variable VarName
IIF(Condition, Value1, Value2)
Text functions:
str(Number,[optional length, optional decimals])
if length set to 0, but decimals<>0, result will be equal trim(str(...))
val(s)
upper(s), lower(s)
copy(s,startpos,[optional count]),
mid(s,startpos,[optional count]),
substr(s,startpos,[optional count])
trim(s)
formatfloat - the same as Delphi FormatFloat
Dataset functions:
eof, bof, last, first, next, prior
for example eof(a), next(table1)
Numeric functions:
round(n,decimals)
round is different from Delphi round function
here 0.5 is always processed to largest integer number
this is NOT banker rounding
int, frac
power, intpower
Date/time functions:
now, date, time, datetostr, datetimetostr, timetostr,
strtodate, strtodatetime, srttotime, year, month, day,
SYEAR(date)
string representation of year
SMONTH(date)
string representation of month
month<10 have zero in place of first symbol - 01, 02 and so on ...
SDAY(date)
string representation of day
day<10 have zero in place of first symbol - 01, 02 and so on ...
DTOS(date)
the result is string yyyymmdd
STOD(string)
converts string like yyyymmdd to date value

Version 2.02
fixed bugs:
- picture inserted trough the frtf() function was duplicated in output file;
- report generator didn't process MS Word fields inserted through the frtf() function;
- couldn't set UDFList property to nil;
- in some cases report executing status was "true" after exception;

Version 2.01
fixed bug when some fields with spaces in name didn't work.

Version 2.00
new construction \if(...)\ \else\ \endif\;
scan "while" keyword now works with report variables and data fields;
new formats: frtf() - for rich text fields, fbool() - boolean;
constants support: \True\ \False\ - boolean, {yyyy-mm-dd} - date constants;
new methods: CreateTmpFileName, CreateFileName;
symbol "." in field names in this version always considered as ":", scan blocks must be defined only with "scan-endscan" keywords;
new help, integrated with Delphi help system.

Version 1.85
new procedure InsertRTFMemoStream in the unit ekrtfstream
new procedure InsertRTFMemo in the unit ekrtfstream
double click on TEkUDFList component opens "Functions" editor window
fixed bug with scan while() function on skipping empty scan block

Version 1.82
fixed bug with fdtm() format and constant parameters with database fields
if dataset is on a eof position after OnScanRecord event, scan block skips the empty record
states of report datasets are returned back to EnableControls, if exception raised while processing the report

Version 1.81
format functions and user defined functions accept string and numeric constants as arguments
extended format of scan block with new keyword "while": \Scan(DataSet), While(UDF(...)), .... \ scan block terminated if result of UDF(...) is "false"
scan-endscan block works on a single line of text
new report template function VAR(var1, ..., varN) - creates variables var1 - varN if they don't exist
new option eoNumericFormatClearZero - deletes zero numbers in numeric formats output
fixed bug with output blob jpeg images
new method ShellOpenFile

Version 1.70
created new component TEkUDFList for user defined functions
new property UDFList in TEkRTF component
extended syntax of report template in according with UDF support

Version 1.62
fixed bug with incorrect exception in method SetTemplateBuffer

Version 1.61
more than 26 datasets support
fixed bug with FormatIndex=0 in event OnImageFormat

Version 1.6
new methods for manipulating with report variables: VarByName, ClearVars, CreateVar, FreeVar
extended format of scan block
new keyword \ScanFooter\
total and count functions sum(), ctn(), cts() for scan block commands
new format functions fdtm, ffixr, fnumr
properties DecimalRSeparator, DecimalRTerminator for using with "ffixr" and "fnumr" formats
new option eoDotAsColon
cached structure of dataset files
IMPORTANT: In this version option eoDotAsColon is True by default. It means that all field names like \DataSet.Field\ will be considered as \DataSet:Field\
If you use implicit cycles on MS Word table with field inside that has syntax \DataSet.Field\, you should replace it with \DataSet:Field\ and use keywords \Scan(DataSet)\ and \endscan\
If you still wish to use old (not reliable) method to make cycles, you must set option eoDotAsColon to False in corresponded EKRTF components.

Version 1.50
"noeof" option in "Scan" keyword \Scan(DataSet)[,page][,noeof]\ - scan block will be missed on eof of scanned dataset
new keyword \ScanEntry\
extended syntax for fields with spaces in names
optimized core of report engine
#11 will appear as "line break" control in output file,
#12 will appear as "new page" control in output file
Version 1.48
property ExecuteSuccessful (true if no errors)
property LastErrMsg (contains last error message if Execute report fails)
fixed bug with omitted exceptions
added additional checking to ExecuteOpen method
Version 1.47
"page" option in keyword \Scan(DataSet)[,page]\. Forces to begin new record of scanned DataSet with new page.
New extended syntax for field names: \DataSet:(NNN)\ , NNN is field number in DataSet.
Version 1.45
ExecuteStream method.
New format function flnk() - hyperlink format
ExecuteOpen works from console applications.
Version 1.42
Methods: SetTemplateBuffer, FreeTemplate.
go top

3. LICENSE
EK RTF COMPONENTS ARE DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR
IMPLIED. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES OR ANY OTHER KIND
OF LOSS WHILE USING THIS SOFTWARE. THIS PRODUCT IS FREE ONLY FOR EVALUATION USING.
YOU MUST REGISTER YOUR COPY OF EK RTF IF YOU USE IT IN REAL PROJECTS.
THE EVALUATION VERSION OF EK RTF REPORT FILLS THE "AUTHOR" AND "COMMENTS" PROPERTIES OF
OUTPUT DOCUMENT WITH INFORMATION ABOUT THIS PRODUCT. EVALUATION VERSION MAY ALSO HAVE SOME LIMITATION, DESCRIBED IN DOCUMENTATION OR README FILES.
Registered users will receive source code and updates applicable for current version.
To register this product goto http://ekrtf.code.net.ru/reg.html Also you may go to
directly to registration page
go top

4. INSTALLATION
1. Uninstall previous version of EkRTF:
Select "Component/Install Packages" from the Delphi IDE. Select the package file ecomp.bpl,
click "Remove" button, click "OK". Select the package file edsn.bpl, click "Remove" button, click "OK".
2. Install package ecomp.bpl:
Select "Component/Install Packages" from the Delphi IDE. Press "Add" button. Select file ecomp.bpl,
3. Install package edsn.bpl the same way as ecomp.bpl
4. Select "Tools/Environment Options" from the Delphi IDE.
5. Select the "Library" tab.
6. Check the path to *.dcu files in "Library Path" edit box. It must reference to location where is the
new version of EK RTF components. Installed component will appear on "Data Access" panel.
HELP INSTALLATION:
1. Remove all previous versions of help from your computer.
2. Delete lines referencing to ekrtf from DELPHI7.CNT (DELPHI6.CNT, DELPHI5.CNT, DELPHI4.CNT), DEL6VCL.CNT.
3. Unpack new help files in some directory of your drive.
There is no necessary to create multiple copies of help files for each version of Delphi.
4. In Delphi IDE choose "Help/Customize". "Open Help" window will appear.
5. Click on "Link" section. Click "Edit/Add files". Choose ekrtf.hlp.
6. Click on "Index" section. Click "Edit/Add files". Choose ekrtf.hlp.
7. Click "File/Save project"
ATTENTION: Sometimes "Open help" doesn't work. In this case you may install help file manually:
Remove EK RTF links from "Open Help" project;
Edit file DELPHI7.CNT (DELPHI6.CNT, DELPHI5.CNT, DELPHI4.CNT):
After line
:Title Delphi Help
add
:Index TEkRTF report component=full_path\ekrtf.hlp
In addition, for Delphi 6 edit file del6vcl.cnt - after line
:Title VCL Reference
add
:Index TEkRTF report component=full_path\ekrtf.hlp
Delete file Delphi7.gid (Delphi6.gid, Delphi5.gid, Delphi4.gid) in Delphi help directory, to initiate help index rebuild on next help request in Delphi.
go top

5. TROUBLESHOUTING
Before running demo projects, check that you have application associated with doc and rtf files.
Otherwise output files will be saved on disk, but will not open automatically.
Delete all pathes from menu Tools\Enviroment options\Library\Directories\ which references to
old versions of component. If compiled programm cannot find input rtf file and generates exception place
your compiled exe file into project source directory (directory with source rtf files) or type full path and file
name in property "InputFile".
Check a FAQ page
go top

6. CONTACT INFORMATION
if you have any questions, comments or suggestions email to support@code.net.ru
See the latest version of Ek RTF Report on component home page at http://ekrtf.code.net.ru

go top