Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Save report with subreport in txt file

edited September 2006 in General
Hello, first of all, sorry by my english.
I am new using reportbuilder.
I need to know if reportbuilder can save a report with subreports in a
txt file.
I have tried with a report without subreport and the txt file was
generated fine. But I have tried with a report with subreports and the
txt file was generated bad. The lines generated are in desorder. The
lines of two subreports appears mixedly, some lines of subreport 1 then
some lines of subreport 2, then some lines of subreport 1 again.
I don?t know, what can I try. I hope you can help me.

Thanks in advance.

Guillermo



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited September 2006
    Hi Guillermo,

    Are you exporting to a delimited textfile or a Report Emmulation Textfile?
    Exporting subreports to a delimited textfile is not natively supported in
    ReportBuilder however you can work around this limitation by using the
    method in the example below.

    http://www.digital-metaphors.com/tips/PrintToPrinterAndTextFile.zip

    If you are exporting to a Report Emmulation Textfile you will need to keep
    in mind that everything in a text file is spaced on a character grid, rather
    than in pixels. Take a look at the following article on printing to a
    dot-matrix printer. The same concepts apply.

    -----------------------------------------------
    Tech Tip: Printing to Dot Matrix Printers
    -----------------------------------------------

    Dot matrix printers are natively line and character based. Most dot matrix
    printers can emulate graphical (i.e. pixel based) printing, but there is
    additional overhead which degrades printing speed.

    Some options for maximizing performance:

    1. Use native printer fonts.

    Each dot matrix printer normally has some built-in fonts. You can choose
    these fonts when using the ReportBuilder Report Designer. Choose File |
    PageSetup and select the dot matrix printer (or optionally use the object
    inspector to set Report.Printersetup.PrinterName). The fonts displayed in
    Report Designer's font drop down list located on the format toolbar will
    display the printer native fonts (indicated by a special printer icon next
    to the font name).

    2. Vertically position and size objects in 1/6 inch increments.

    A standard dot matrix printer can print 66 lines per 11 inch portrait page.
    This translates to a line height of 1/6 inch. Therefore the height of each
    band should be a multiple of 1/6 as should the size of the margins, the
    vertical position of each object etc.

    Tip: When designing the report, use the PrinterSetup property to specify a
    printer that contains 600 dpi. Then set Report.Units to PrinterPixels. Now
    100 pixes = 1/6 of inch when specifying the positions of objects in the
    layout.


    3. Keep the layout simple, avoid using graphics of any kind.

    Alternatives to using the dot matrix printer driver:

    1. Use the generic text printer driver.

    When using the generic text printer you will need to use the courier or
    courier new font and apply the layout techniques described above.

    2. Use ReportBuilder's ReportTextFile device output format.

    This ReportTextFile device can exports the report to a .txt file which you
    can then send to the printer. Demo dm0107.pas in the main reports demo app
    shows an example of printing a report to a .txt file and previewing the
    results.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    Thank you for your soon answer.

    The code that I am using is similar to the example, I will try with the
    code of the example.

    The solution that I developed is scanning each subreport and write the
    contents in a file. There is not a better solution but is a solution.
    If I can develop a better code I will expose here.

    Thanks again.

    Guillermo



    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.