Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
487 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (9)


How to make reports in RTF formatComponent available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
using EK RTF report component
Product:
Delphi 4.x (or higher)
Category:
Reporting
Skill Level:
Scoring:
Last Update:
05/03/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet RTF report charting word ek table database dataset quick builder field
Times Scored:
27
Visits:
16808
Uploader: Eugene Kuchugurov
Company:
Reference: EK RTF home page
Component Download: http://www.torry.net/vcl/reports/reportenhancements/ekrtf.zip
 
Question/Problem/Abstract:
How to make reports as nice as MS Word document? What if I wants that my reports were editable? How to make reports in RTF format?
Answer:



Using QR, I have tired to click on a form in attempts to get perfect reports. In this case I thought that it is a good idea to make report templates in Microsoft Word and get result in RTF format. Reports in RTF format is editable. Also don't worry about printing from your application, because this for you will do Word or any other editor, which you use.

This idea realizes in EK RTF report component for Delphi. Let me show you in details how to make reports, using EK RTF report component.

First of all you need a report template in RTF format. You may create a pattern of report by any available editor facilities, using font formatting, justification, colour, tables and other ways of formatting.

To insert fields or variables from database in your report, use controlling words - they must be comprised between symbols "\" (back slash), for instance: \date\ or \Query1:CustNo\

Variable, which must be inserted in report will be assigned in VarList property in format variablename=value. For instance: if in the list VarList is kept a line name=John Smith, in the pattern of report must be a field \name\.

You may insert in the report all records from table or query. For this in the editor (in Word or other) create a scan block with table. Use keywords \Scan(datasetname)\ and \endscan\. Type a name of fields to be inserted in the report in cells of the table. For example:

Datasets are identified by name or by means of char a-z in that order, in which they were sent in Execute method.

You may insert all records of dataset in the document in any free form, not only as table. Inside cycle scan-endscan can be located block of text of any form with names of data fields and variables, for example:

\Scan(Query1)\
Order number is \Query1:OrderNo\ Order sum is \Query1:OrderSum\
\Endscan\

Lines with words "scan", "endscan" are excluded from the result document. However, if in step of designing a report you want to see as will look a result, you may set an attribute "hidden font" for words "scan", "endscan".

There is an example of master-detail report:

Component TEkRTF is used In this example with properties: Lang=wdEnglishUS, Name=EkRTF, properties INFILE, OUTFILE filled rtf file names. DisableControls=False. The other properties are left without changing.

There are used tables ORDERS, CUST, ITEMS from DBDEMOS database. In the table ITEMS MasterFields=OrderNo, MasterSource=OrdersSource. Tables are in data module named DM.

Report template:

Before the executing report an user chooses an order number in ORDERS table. Correspond record in the table becomes the current. The second table is inside SCAN-ENDSCAN block. This allows to insert all records from table ITEMS, which correspond OrderNo from table ORDERS.

Code to generate a report:

custno:=Dm.orders.fieldbyname('custno').AsInteger;
Dm.cust.Locate('CustNo',custno,[]);
EkRtf.ClearVars;
EkRtf.ExecuteOpen([DM.Cust,DM.Orders,DM.Items], SW_SHOW);

Result:



EK RTF report component for Delphi home page
Storing EK RTF report template in blob field









Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Images
    Marcelo Torres (Jul 7 2000 4:17PM)

I can`t see the images this article..... :-(

Respond

RE: Images
Stefan Walther (Jan 4 2001 6:21AM)

... now the images are visible ...
Respond

Printing RTF reports
    Bill Sorensen (Jul 7 2000 3:48PM)

Now let`s say you have a nice report saved to disk in RTF format.  Let`s also say that report is on a client`s system, and the client doesn`t have MS Word.  How do they print it?

Yes, they can download MS WordView for free.  However, that requires manual intervention to print a document.  And WordPad doesn`t handle some of the fancier RTF, such as the Word 97 extensions.

Does anyone know of a component that will print Word 97-style RTF without Word on the system?
Respond

RE: Printing RTF reports
Eugene Kuchugurov (Oct 12 2000 9:07AM)

You may use Wordview 95 v. 7.1 with command line option /p
Respond

How to post an article ...
    Bernhard A. (Jun 15 2000 5:24PM)

Dear Eugene Kuchugurov,

please have a close look at delphi3000.com and you will recognize, that you can ask questions inside the forum !!! If you post an article, you have to post and article ;-) not a question - refer to the posting-guidelines !!

I will have to delete this article ... (or somebody is going to give a detailed answer...)

thanks for your support
Bernhard A.


Respond

RE: How to post an article ...
Your website (Jun 15 2000 8:29PM)

...ah, i saw your website. Its ok when you basically refer to your website, where you can download the component...

The only must is that there is an article with a direct benefit for the users of delphi3000.com - otherwise this will get just a collection of links here !

thanks
bernhard a.
Respond

Be patient.
Eugene (Jun 15 2000 9:37PM)

Full article were sent to webmaster.
Respond

RE: Be patient.
Bernhard A. (Jun 18 2000 12:15PM)

great article !!

thanks for joining delphi3000 !
bernhard a.
Respond

problem
zaireen (Jun 24 2000 3:55AM)

hi.. i`m a beginer in delphi programming..
so.. do you mind if i`m asking a question..

my question is... can we generate a report in html
format then link it to delphi.

thanks
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
D. Souchard
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)