Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1009
  • Last Modified:

Printing memo fields through Quickreport in Delphi 3

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
venks
Asked:
venks
  • 7
  • 6
  • 2
  • +1
1 Solution
 
rwilson032697Commented:
Try using the OnNeedData event in TQuickReport to fill in the memo field.

Cheers,

Raymond.
0
 
venksAuthor Commented:
Rwilson
I am sorry.But that is a very sketchy answer.Please give more details and if possible some code.
Regards
venks
0
 
rwilson032697Commented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
venksAuthor Commented:
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
 
ZifNabCommented:
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
 
venksAuthor Commented:
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
 
ZifNabCommented:
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
 
venksAuthor Commented:
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
 
ZifNabCommented:
I look at an older project in which I've used DBMemo's.
0
 
venksAuthor Commented:
Dear Tom
Thanks
venks
0
 
ZifNabCommented:
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
 
elkiorsCommented:
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
 
venksAuthor Commented:
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
 
ZifNabCommented:
Hi venks,

Glad it worked with this proposal :

  TQRDBText
    Wordwrap = true
    Autostretch = true

Regards, Zif.

       and it works perfectly.
0
 
venksAuthor Commented:
Dear Tom
Thanks once again
venks
0
 
ZifNabCommented:
no problem venks, we're here to help each other out. Zif.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 7
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now