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

Different XLSSettings for TppXLSXDataDevice and TppXlsxReportDevice

I needed to define different options for XLS export for the Data File and Report File exports. For example, it is useful to have IncludeSingleHeader = True for Data File exports and IncludeSingleHeader = False for Report File exports.

I initially did this using the TppReport.OnPrintDialogClose event. However, I wanted our default settings to appear in the dialog, for the dialog to update as the user changed the file type, and for the user to still have the option to override our defaults. So, I replaced that with additional code added to TppExportFileDialog.cbxPrintToFileTypesChange.

FAdvancedFileOptionsXLS.UpdateFileSettings(XLSSettings); XLSSettings.IncludeSingleHeader := FileDeviceClass.InheritsFrom(TppXLSDataDevice); FAdvancedFileOptionsXLS.InitializeOptionControls(XLSSettings);

It would be nice if there was a cleaner method that I did not discover or if a cleaner method could be implemented in a future version.

Thanks

Comments

  • Hi Jon,

    I researched this and for the next release will add TppExportFileDialog properties

    protected
    property AdvancedFileOptionsPDF: TppAdvancedFileOptionsPDF read FAdvancedFileOptionsPDF;
    property AdvancedFileOptionsRTF: TppAdvancedFileOptionsRTF read FAdvancedFileOptionsRTF;
    property AdvancedFileOptionsXLS: TppAdvancedFileOptionsXLS read FAdvancedFileOptionsXLS;
    That will enable you to create a TmyExportFileDialog descendant class and do something like

    procedure TmyExportFileDialog.Init;
    begin
    inherited;

    cbxPrintToFileTypes.OnChange := cbxPrintToFileTypesChange;

    end;

    procedure TmyExportFileDialog.cbxPrintToFileTypesChange(Sender: TObject);
    begin

    inherited cbxPrintToFileTypesChange(Sender);

    // do custom logic here

    AdvancedFileOptionsXLS.UpdateFileSettings(XlsSettings);

    end;



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
Sign In or Register to comment.