Printing questions

How could i Print a TStringGrid descendant with the TfrPrintGrid
Is Possible?
Yea, i think the answer should be NO, but maybe some1 has a solution for printing StringGrids with the FastReport stuff..

Plz help me... I need Preview too, that's why i choosed to use FastReport..

Thanks a lot in advance. Hope your help.

Comments

  • edited 12:59PM
    Hi!

    Yes it is possible. The TfrUserDataSet component is built especially for this kind of situations. The following is a quote from the fr_eng.doc. Read it carefully.



    TfrUserDataSet component

    This component is also used to navigate a dataset but it uses data structures such as array, StringGrid, external file and so forth, instead of a database, as the source for the data.

    Event Description

    OnCheckEOF Event handler takes one parameter - EOF of Boolean type. Set this parameter to True to stop navigation.

    OnFirst Event handler must set pointer to the first record.

    OnNext Event handler must set pointer to the next record.

    OnPrior Event handler must set pointer to the prior record.


    In this case the Words "pointer" and "record" are allegorical and not literal. If you are working with data from an array, "record" is the row of the array and "pointer" is the variable that stores the current row number.

    Navigation methods are called in the following manner: OnFirst, OnCheckEOF, OnNext, OnCheckEOF, OnNext, ..., OnCheckEOF, OnNext. If the report has groups, then the method OnPrior is also called after the group ends.

    If you know the number of "records" before building the report, you can use the RangeEnd and RangeEndCount properties. Just set RangeEnd := reCount and RangeEndCount := number of records (for instance, number of array's rows). In this case, you can leave the OnCheckEOF event handler empty. To find the current row's position, use the RecNo: Integer property. At the First position RecNo = 0.


    Regards: Alex
  • edited March 2004
    Thanks god !!
    nice to learn that it is possible...

    but: i'm a little newbie...
    maybe some code sample or easy steps to
    . which another compos use.. (tfrreport?)
    . which bands to add (i made the title, header, etc. already)
    . how to transfer each grid's row to the report before previewing..
    . and that

    thanks again... ;)
  • edited 12:59PM
    I will load up a complete example to the file section of Yahoo Groups and will post the link here.

    Regards:Alex
  • edited 12:59PM

    I will wait for it as my wedding...
    ;) ;)

    i didn't knew about FastReport in Yahoo..
    thanks master
  • edited 12:59PM
    Hi!

    I uploaded the demo project that will show You the usage of userdataset component. I'm not sure that is the recommended usage, but this demo works fine and the things came from my mind since I haven't seen any FR related demo showing the usage of user dataset.
    The report itself is stored in the dfm. So here is the link:

    http://f4.grp.yahoofs.com/v1/MA1kQGUfoox5a...ug/fruserds.ace

    I hope this will help You.

    Regards:Alex
  • edited 12:59PM
    Unfortunately the link was modified (don't know why) and here is the correct link:

    http://f4.grp.yahoofs.com/v1/UClkQMgqVhI1q...ow/fruserds.ace

    Alex
  • edited 12:59PM
    sorry but none worked...
    could u send me to my mail?

    qbecerra AT hotmail dot com ?

    thanks a lot m8 ... really...

    or maybe tell me which group is the one at yahoo and i join (maybe i gotta do that to get the file )

    cya
  • gordkgordk St.Catherines On. Canada.
    edited 12:59PM
    hi Henry
    here is the link to the group you have to join to be able to dl
    http://groups.yahoo.com/group/fastreport
    regards ;)
  • edited 12:59PM
    Great dude !!
    I got the example and gonna test it right now

    thanks both 4 all the helpful u have been !!
    ;)

    PS: found other interesting files there... and another example of StringGrid reporter too !!
    nice !! ;)
  • edited March 2004
    I found 3 little troubles.
    1 fixed but maybe fixed in the bad way...

    1. I have a TCustomStringGrid which allows me to put Columns widths, headers, etc. Well... When the report showed... i saw the header in it, but it must not be there, only the "data"... and well, some times i saw repeated the 1st row of data.
    I fixed it like this:
    I added the +1

    procedure TFormInformes.UDatasetNext(Sender: TObject);
    begin
    begin
    frVariables:= GrillaVtas.Cells[0,UDataSet.RecNo+1];
    frVariables:= GrillaVtas.Cells[1,UDataSet.RecNo+1];
    frVariables:= GrillaVtas.Cells[2,UDataSet.RecNo+1];
    frVariables:= GrillaVtas.Cells[3,UDataSet.RecNo+1];
    frVariables:= GrillaVtas.Cells[4,UDataSet.RecNo+1];
    end;
    end;

    but maybe it is in a bad way... maybe there's a better solution.

    2. The other problem i had is that:
    my F5 variable is a float number... it shows nice in the report, but when i try to put a text box with "[SUM(F5)]" in the report summary band... i get an error before showing...
    "Invalid variant type conversion"

    Then, i changed it to [SUM(STRTOFLOAT(F5))]. It showed fine, but the value was 0. And same for my int variables...

    I also got 0 for when i put [COUNT(F3)] where F3 is int var... (got no "Invalid....")

    3.
    [TOTALPAGES] var shows 0 when i have only 1 page... I've not tested having more than 1 page report...

    Can some1 point me to correct fix 4 these?
    Thanks a lot in advance.

    ;)
  • gordkgordk St.Catherines On. Canada.
    edited 12:59PM
    Hi
    first to get total pages report must be 2 pass.
    when summing or counting use correct syntax
    ie box with "[SUM(F5)]"should look like
    [Sum([F5],bandname,1)]
    note ,1 is optional it retrieves non visible values.
    when you want to retreive the value of a variable in a report it must be enclosed
    in [ ].
    count will just be [count(bandname)] no variable.
    as far as index positioning for records you probably forgot your stringgrid array is 0 based row 0 is header, row1 is first datarow. same for columns.
    regards ;)
  • edited 12:59PM
    thanks master !!
    would u mind to tell me how to do with TOTALPAGES?
    What is 2 pass Report? ;)

    thanks again

    ;)
  • gordkgordk St.Catherines On. Canada.
    edited 12:59PM
    Hi
    Suggest re reading documentation,
    take time to run the demos provided they cover 95% of what is usually required.
    In design mode goto file>report options set 2 pass option.
    2 pass forces the report engine to make 2 passes before displaying preview.
    info is gathered on first pass to be used in output of second(final) pass.
    regards ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.