Home Subreports

Saving report in a txt file

edited January 2008 in Subreports
Hi,

We use the report builder embedded in another application. I don't
know if the print options come from the report builder self or another
plug-in ?

From the report preview we can chose to print to a text file (or
excel, of PDF, enz)?

We need to make a report that doesn't get printed but exported to a
txt file, wit ; delimiters.

The report builds in the detail band 6 strings, and prints them onder
each other in the footer.

When we save the preview to a file, we get "1" line instead of 6
lines.

We had to make 6 groups, each printing 1 line in its footer to finally
get a txt file with 6 lines.

If there a way to force a carriage return (via the string ?) .

Whith the groups we get a (known) problem with page change. The
strings are build onder other variables conditions (out of the
pipeline, dbcalc), but these are set to 0 before the strings are
displayed in the group, so some lines after the page change are not
printed because the condition is always 0.

I've got from Nico a "solution" for this problem when it has to do
with calculations (the totals were wrong by page change, other post),
but in this case, I can't use the page summary to print the results,
they must really be printed in each group footer in order to get the
final text file right...

Any idea how I can fix this?

Is there a way to insert a "return/enter" character to the string file
that would be saved correctly in the txt file?

Or a way to set up the variables in the footer of the groups so that
they are calculated at the right time (before the dbcalc is set to 0)
?

Thankx for your help

Chantal Marchand

Comments

  • edited January 2008
    Hi Chantal,

    One option would be set the TextFileType option to ftCustom, then use the
    OnSave event to add your own formatting to each value. You would for
    instance simply add a ";" character for each value until you export the
    values in the footer in which you would export a ";" plus a CRLF.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2008
    Hi Nico,

    Would you have an example of this kind somewhere I can look at?
    I've never directly modified file properties/events before.

    And how do I export a "CRLF" ? I don't know if I must use a special
    symbol but everything I've tried to use in a string just "displays"
    the caracters instead of seeing it as a control en translating it to
    an actual carriage return...?

    Thankx,

    Chantal

    On Mon, 14 Jan 2008 12:45:22 -0700, "Nico Cizik \(Digital Metaphors\)"
  • edited January 2008
    Hi Chantal,

    You can use the TppReport.OnSaveText event to gain direct access to the
    string being exported. The "Text" parameter is the string to modify.
    Something like the following will add a ";" delimeter and break to the next
    line after every text object.

    procedure TForm1.ppReport1SaveText(Sender: TObject; var Text: string);
    begin
    Text := Text + ';' + #13#10;

    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2008
    Good...I'm getting there...
    I managed to get de ';' where I needed them, but I can't get the
    carriage return...
    #13#10 won't compile...it's expecting a string but if I give him a
    string it just displays it... something like " text Hello ; #13#10
    text 2 Work ; #13#10" ...

    How do I get controle characters in?



    On Tue, 15 Jan 2008 09:30:26 -0700, "Nico Cizik \(Digital Metaphors\)"
  • edited January 2008
    Ohhhh. Just found it ... chr(10) does the job...

    Thankx for your help!

    Chantal
This discussion has been closed.