- Miller Rhodes
- PowerBuilder
- Saturday, 20 May 2023 11:11 PM UTC
I am currently using GetFileSaveName in combination with SaveAs so that I can filter the available SaveAsTypes.
There doesn't seem to be any way to send something from the GetFileSaveName that will allow you to know whether
the user wants headers or not.
In my code below, I am using the file type return to pick the parameters to send to SaveAs. I am using the 'headers' option as the default because I see
nothing I can grab from the GetFileSaveName to pick whether I want a header or not.
Has anyone found a way to do this ?
integer li_rc
string ls_file, ls_file_type, ls_path
li_rc = GetFileSaveName ( "Select File", ls_path, ls_file, ".XLSX", + "Excel Files (*.XLSX),*.XLSX," + "Excel Files 97-2007 (*.XLS),*.XLS," + "CSV Files (*.CSV),*.CSV," + "Text Files (*.TXT),*.TXT," + "PDF Files (*.PDF),*.PDF," , ls_current_dir, 32770)
If isnull(li_rc) or li_rc <> 1 then return
ls_file_type = Right(ls_file, 3)
ls_file_type = upper(ls_file_type)
Choose Case ls_file_type
Case 'XLS'
dw_report.SaveAs(ls_path, Excel8!, TRUE )
Case 'LSX'
dw_report.SaveAs(ls_path, XLSX!, TRUE )
Case 'TXT'
dw_report.SaveAs(ls_path, Text! , TRUE )
Case 'CSV'
dw_report.SaveAs(ls_path, CSV! , TRUE )
Case 'PDF'
dw_report.Object.DataWindow.Export.PDF.Method = NativePDF!
dw_report.SaveAs(ls_path, PDF! , TRUE )
Case ELSE
Messagebox('Report Window Export','Invalid format chosen. Please try your export again', StopSign! )
Return
End Choose
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.