Save To Excel from preview not working


I'm sure I am missing something obvious here, but I can not get Fast REports VCL to export a report to excel from the preview screen. Using the frxReport.Export() works fine, but I want my end-user to have the ability to press the save button on the preview screen, pick Excel, and have it work. The Word export does nothing also.

PDF, HTM, FP3, all seem to work as expected.

Comments

  • G'day Nathan,

    First point: have you dropped an instance of the TfrxXLSexport Component on your Form (or within the scope of the code)?

    If so, when you click on the "Save" Button on the Report Preview Form you should see:

    If you click on this Option you get something like the following displayed:

    Second point: are you happy with the results this produces? We tried for a long time to "leverage" our FastReport designs in various Exports (including to Excel) but gave up on most of them because they are very literal. The export contains empty cells and columns etc. to replicate the formatting of the Report. For the purposes of "downstream" processing of the Workbook data it was impossible.

    Our Application Programmes now use the "native" code in Delphi to do ISAM Exports reusing the SQL on which the Reports are based.

    However, you may have different design objectives...

    Cheers, Paul

    P.S. I temporarily re-enabled "XLS Export" for the sake of this Post. The "Save" Menu above shows the the Excel Option as it is "out of the box" whereas the other Options have been tweaked by us to be more user-friendly 😉

    -P

  • I do have the export component in the same data module as the report, and when I explicitly call frxReport.Export() with it, it works fine. From the preview screen I do see Excel under the options that are presented when I click the save button, but when I click it nothing happens. This works fine in other projects. Is there anything else that could affect this?

  • G'day Nathan,

    As i said the TfrxXLSexport component worked "out of the box" meaning I didn't set any Properties to special values via tge Object Inspector. And yes ours was dropped on toa Data Module like yours.

    Did you change any Properties or Event links?

    Perhaps you could show a screenshot here, to help us work this out.

    Cheers, Paul

  • Hopefully this video helps explain what I am seeting... https://capture.dropbox.com/iZ44eDTq904hfJhZ

  • Ah... I think I am on to something here... Your comment about changing any properties or event links got me thinking that I AM checking the xlsxExport component's filename property in the OnBeforeExport event and popping up a save dialogue to set it.

    However... I still can not explain why it does not actually do the excel export.

    I am doing this:

    procedure TdmData.frxlsxExportBeforeExport(Sender: TObject);

    begin

     if (frxlsxExport.Filename = '') then

     begin

      dlgSave.Filter := 'Excel Files (*.xlsx)|*.xlsx|All Files|*.*';

      dlgSave.InitialDir := GetDesktopDirectoryFolder();

      if (dlgSave.Execute()) then

      begin

       frxlsxExport.Filename := dlgSave.Filename;

      end;

     end;

    end;


    This explains why the first time I select Export it prompts for a filename, but the second time it does not. It does not explain why it isn't doing the actual export though? Do I need to call frxReport.Export myself when the export button is clicked? I thought this functionality was inherent? Also I am not explicitly calling .export for the .pdf export or the .fp3 export or the .rtf export, all of which seem to work fine...


    Thanks again for all your help with this!

  • Works OK. FR VCL 2024.2.9, Delphi 12.1, Windows 10 64bit, MS Excel 2013 installed (needs to work OLE TfrxXLSExport)

  • I do not have Excel installed. Was not aware this was a requirement. Shouldn't it generate some sort of exception in this case? Can I export Excel without Excel installed?

  • Use BIFF8, XLSX or XML export filters

  • edited October 9

    Make sure all necessary export components, like TfrxXLSExport and TfrxDOCXExport, are loaded to enable exporting to Excel and Word. If these components aren’t linked, the export button in the preview won’t work. You can manually add them in the report settings. Sometimes these issues come from missing references or outdated libraries. Manually loading the components worked for me, so maybe this will help in your case too. [url=https://podpytaj.pl/]:)[/url]

  • Sorry. what do you mean by "manually add them in the report settings"? I have the export componenets in the same data module as my report, and other exports seem to work fine?

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.