Hello!
I have an XMLport that exports a report to a CSV file. No issues there. When the XMLport runs, I would like the file to be saved to the export folder without the Export File Dialog box opening and asking: “Do you want to open or save this file?” See Image1. There is a checkbox that I can uncheck “Always ask before opening this type of file.” But when I uncheck it,the Export dialog box still opens up, see Image2, with the correct export folder automatically selected, but I still need to click the Save button.
How can I get the XMLport to Save a file without any interaction from the user? Image3 shows the properties of the XMLport.
Thanks!
0
Answers
Do it this way, it will help you for sure.
https://msdn.microsoft.com/en-us/library/hh166529(v=nav.90).aspx
dynamicsuser.net/nav/f/106/t/72355
dynamicsuser.net/nav/f/106/t/69123
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
And put thos code in the
OnPreReport()
// FileMgt codeunit 419
// FileName Text
// OutFile File
// OutS OutStream
// Xmlp your XMLPort
FileName := FileMgt.ServerTempFileName('CSV');
OutFile.CREATE(FileName);
OutFile.CREATEOUTSTREAM(OutS);
Xmlp.FILENAME(FileName);
Xmlp.SETDESTINATION(OutS);
Xmlp.EXPORT;
OutFile.CLOSE;
FileMgt.DownloadToFile(FileName, 'c:\output\ExportFile.csv');
And execute the report.
You can create a codeunit too with the same code if you like it more.
Regards.