Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SaveDialog in Intraweb 14
Hi, I am making a program for internet using for this intraweb 14.0.29 and I would like your help to solve the creation of a file.

In the win32 version of the program create an excel and download it wherever the user wants, but with Intraweb it does not make it work, using the typical TFileSaveDialog components to select the path.

I use something like this.

if fdquery1.IsEmpty = FALSE then
Report := TFlexCelReport.Create(true);

if not SaveDialog1.Execute then exit;

Report.AddTable('fdquery1',fdquery1, TRecordCountMode.SlowCount, TDisposeMode.DoNotDispose);

  Report.SetValue('empresa',combobox7.text); // .SetCellValue(1, 1, statusbar1.panels[2].Text);
  Report.SetValue('ejercicio',edit9.Text); // .SetCellValue(1, 1, statusbar1.panels[2].Text);
  Report.SetValue('periodo',combobox8.Text); // .SetCellValue(1, 1, statusbar1.panels[2].Text);
  Report.SetValue('fecha',datetimetostr(now)); // .SetCellValue(1, 1, statusbar1.panels[2].Text);

  Report.Run(ExtractFilePath(application.ExeName)+'\EERR_SAP.xlsx', SaveDialog1.FileName);

  if MessageDlg('Se ha exportado correctamente. ¿Desea abrir el archivo generado?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    ShellExecute(0, 'open', PCHAR(SaveDialog1.FileName), nil, nil, SW_SHOWNORMAL);

This won't work. When you run SaveDialog, this is a code that runs on the server computer, not on the user computer.... It won't open a FileSave dialog on their side.

You need to execute a file download. Create a file on the server side and call SendFile() method of the WebApplication. It will prompt the user to save the file on their side.
Thanks Alexandre.
Can you give me an example where the client selects the destination directory ??

you cannot directly force a user to select a specific directory for downloading a file due to security restrictions imposed by web browsers. The file download process is controlled by the user's browser settings.

When a file is downloaded, the browser prompts the user to choose the download location or uses the default location specified in the browser settings. When/if prompted, the browser typically provides a standard save dialog, and the user has the freedom to select any directory they prefer or stick with the default.
Thank you very much and I understand what you say.
First I need to create the file locally on the server and then send it ?
Please can you send me a small code example of how I have to do it ?
Thanks Paul.
Finally I was able to download the file Ineed, but after downloading it the page is stuck with the symbol of thinking.
What could it be? How do I solve it?
Did you do this in your own app or in the features demo?

If in your own app, did you put the following code in the the scriptevents.onclick event:

return true;

Cheers, Paul
I test my own app.
Where is the scriptevents.onclick ??
It's from the main form, servercontroller or the button ??
Sorry, its my first intraweb app.
In the properties of the Button.

Forum Jump:

Users browsing this thread: 1 Guest(s)