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

Preventing items from being exported to some export types

edited October 2010 in General
Hello,

I'm using D2007 and RB 12.02 and so far I'm liking your new export devices.
But I'm wondering if there is a way to prevent certain items from being
exported to certain types? For example I have an image and a TChart that I
would like to have exported when printing to PDF or word but I don't want
them exported when printing to XLS.

Also in my MDI application I would like to have some reports only able to
print to PDF and then other reports I would like to have them only able to
print to PDF and XLS. I tried doing the ppUnregisterDevice() call in the
OnPreviewFormCreate event but if a user runs one report then runs another
report with out closing the first, when they switch back to the first report
and choose print to file all the options of the second report are available.
Is there a way to prevent this behavior that I'm not seeing?

Thanks in advance,

Thanks in advance,
Rodger Van Kirk

Comments

  • edited October 2010
    Hi Rodger,

    1. You can use the Report.XLSSetting.ExportComponents property to determine
    which components you would like to allow your users to export to Excel.

    2. ppRegisterDevice and ppUnRegiserDevice are global functions that will
    manipulate the global device resource. If you are running multiple reports
    at once I suggest directly accessing the PrintDialog and limiting the
    devices shown in the device ComboBox. This can be done either by creating a
    custom Print Dialog or directly accessing the ComboBox control
    (PrintDialog.cbxPrintToFileTypes) after the print dialog has been created.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2010
    > 1. You can use the Report.XLSSetting.ExportComponents property to

    Thanks. Found it.


    Do you have a sample of either of these?

    Thanks in advance,
    Rodger Van Kirk
  • edited October 2010
    Hi Rodger,

    1. The ComboBox in the existing print dialog is simply a TComboBox. See the
    Delphi help for how to manipulate it's values. The best place to access
    this component would be inside the OnPrintDialogCreate event of the report.

    uses
    ppPDlg;

    TppPrintDialog(Report.PrintDialog).cbxPrintToFileTypes.Items.Delete[3];

    2. Below is an example/article on how to completely replace the print
    dialog.

    http://www.digital-metaphors.com/rbWiki/Plugins/Dialogs/How_To...Create_a_Custom_Print_Dialog

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.