Solved

Printing memo fields through Quickreport in Delphi 3

Posted on 1998-10-28
16
816 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
searching for DavidI's "Mobile Summer School download" 3 128
Print Graphic and Text to Epson TM-T88v 12 185
SUM 2 INTEGER ARRAYS INTO 1 10 93
Graphics32 under Delphi 10.1 Berlin 2 38
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

18 Experts available now in Live!

Get 1:1 Help Now