Solved

Printing memo fields through Quickreport in Delphi 3

Posted on 1998-10-28
16
797 Views
Last Modified: 2013-11-22
I have a table with memo fileds that are filled through othe tables at run tim in such
a manner that a carriage retun is embeeded after each line.
I want to print these through QuickReport Ver 2 k .
The  data of the table for a single record looks like this(for organising a
sports function giving events on different dates with actions to be taken
and resources required)

                   (Integer Field) (Date Field)

                    Ser            Date
                     1             29/10/1998

(Memo Field)         (memo Field)           ( memofield)

Event1               Action1                Resources1
Event2               Action2                Resources2
Event2               Action3                Resources3

I tried printing it through quickreport by using DBtext and DBrichtext.But only a blank appears
Regards
venks
0
Comment
Question by:venks
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1344883
Try using the OnNeedData event in TQuickReport to fill in the memo field.

Cheers,

Raymond.
0
 
LVL 1

Author Comment

by:venks
ID: 1344884
Rwilson
I am sorry.But that is a very sketchy answer.Please give more details and if possible some code.
Regards
venks
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1344885
Here is the help for TQuickRep...

Declaration

property OnNeedData : procedure (Sender : Tobject; MoreData : boolean)

Applies to

TQuickRep
TQRSubDetail

Purpose

OnNeedData is used when creating reports from sources other than Delphi datasources, such as string lists, arrays, text files and almost any other source imaginable. OnNeedData is called whenever QuickReport would normally issue a DataSet.Next command to move to the next record of a dataset. Setting MoreData to False will cause the report (or sub detail) to terminate.

Example

This code will print all strings in a TStringList to in a report:


var
   CurrentItem : Integer;
   SomeStringList : TStringList;

procedure TForm1.QuickRep1BeforePrint(Sender: TQuickRep;
var
   PrintReport: Boolean);
begin
   CurrentItem := 0;
   PrintReport := SomeStringList.Count > 0;
end;

procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData; Boolean);
begin
   if CurrentItem <  SomeStringList.Count then
   QRLabel1.Caption := SomeStringList[CurrentItem];
   Inc(CurrentItem);
   MoreData := CurrentItem <= SomeStringList.Count;

end;

For more information on how to create event driven reports look at the chapter on this topic earlier in this documentation.

Instead of filling the QRLabel you would fill in a QRMemo...

Cheers,

Raymond
0
 
LVL 1

Author Comment

by:venks
ID: 1344886
Dear Rwilson
What i am looking for is to print the data in the DBmemo field of a table which is filled from fields of other tables.
The various lines of the dbmemo are terminated by a carriage return character
The code you have given is from the on line help for qreport
component which is not useful to me in this case.
Thanks anyway
regards
venks

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344887
Hi venks,

Use the QRDBText component for printing your dbmemo-fields, it's designed for that stuff (next to just printing labels).

Regards, Zif.
0
 
LVL 1

Author Comment

by:venks
ID: 1344888
Dear Tom
I have tried (i had mentioned that in my question also)
It does not work.I only get a blank space.
I used the quickreport expert also.Sometimes it shows only the first line of dbmemo field and other times nothing is shown where data should have been there.
Am i required to set some other property also
Even i find it strange that such a result is coming.
regards
vensk
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344889
oops, sorry looked over that last comment.

have you tried using wordwrap, autosize?

Have you tried to use a QRMemo and filling it manually to see what happens? .Lines.Text / .lines.Assign

There was a bug about blank lines, but this should be fixed in 2h.

Zif.
0
 
LVL 1

Author Comment

by:venks
ID: 1344890
Dear tom
I have not yet tried manual filling.Actually i used another component(free and text only report) and it fills up every thing
except that the lines of memo are misaligned and then you have to manually align it(painful and tedious)
I thought quick report should do the trick.But by default nothing is getting loaded.I have to quick report homesite and downloaded the FAQ.But nothing is mentioned as to the job at hand.
Before writing code i wanted to see whether Experts will help out
I will try rhe wordwrap and autosize and come back.
regards
venks
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 8

Expert Comment

by:ZifNab
ID: 1344891
I look at an older project in which I've used DBMemo's.
0
 
LVL 1

Author Comment

by:venks
ID: 1344892
Dear Tom
Thanks
venks
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344893
venks,

I've looked at it and found that it I used it as :

TQRDBText
 Wordwrap = true and Autostretch = true

and it works perfectly.

Database = paradox.

Zif.
0
 

Expert Comment

by:elkiors
ID: 1344894
Is there any reason why you can't use the QRMemo Component, and then use the Lines.Assign Method in the BeforePrint Event of the Detail Band ?

I haven't got much time at the moment to give you a more detailed comment but if it's heading in the right direction let me know and I'll see what I can do tomorrow evening.

Darren

0
 
LVL 1

Author Comment

by:venks
ID: 1344895
Dear Tom
Your suggestion (TQRDBText Wordwrap = true and Autostretch = true ) worked and thanks a lot.
Please answer so that i can award the points
Now i am going to office and will award you the points later in the evening(by my time)
Regards
venks
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1344896
Hi venks,

Glad it worked with this proposal :

  TQRDBText
    Wordwrap = true
    Autostretch = true

Regards, Zif.

       and it works perfectly.
0
 
LVL 1

Author Comment

by:venks
ID: 1344897
Dear Tom
Thanks once again
venks
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344898
no problem venks, we're here to help each other out. Zif.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now