Hi,
I'm using XamReportPreview to display a report. When printing from the print icon, is there a way to set a default filename when the standard print dialog comes up?
For example when the attached dialog box comes up, I'd like to default a filename. Is this possible?
Thanks,
Cristina.testfile.docx
Hello Cristina,
I have been investigating into the ability to provide a default file name when the print dialog shows, and currently there does not exist a way to do this with the XamReportPreview. Internally, when you click the print button, we generate a System.Windows.Controls.PrintDialog and show it. I don't believe there are any arguments on the PrintDialog object that take a default file-name either, though, and so I'm not sure how this would be done, to be honest.
If you would like to see the ability to provide a default file-name for the XamReportPreview, I would recommend suggesting a new product idea for this feature at our WPF Ideas Site. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.
Please let me know if you have any other questions or concerns on this matter.
Hi Andrew,
In that case, Is it possible not to show a filename at all. When you save as PDF the default filename is Infragistics.Windows ( this is not user friendly) .. but when you save as XPS, it does not default a filename. I would like the PDF save to work like the XPS with no default filename.
Cristina.
Cristina,
Does setting ReportSettings.PrintJobDescription to the filename without an extension give give you the behavior you are looking for?
This property is used to set the description in the Print Queue and it seems that the CutePDF printer uses this as the default filename. Note that in my testing when this wasn't set the the default file name was always "Xps Document.pdf" so I am not sure where "Infragistics.Windows" is coming from for you.
I have also attached the project that I was using to test this which has a Report generated from a XamDataGrid in the XamReportViewer and sets the ReportSettings.PrintJobDescription to "filename":
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { Report report1 = new Report(); EmbeddedVisualReportSection section1 = new EmbeddedVisualReportSection(this.xamDataGrid1); report1.Sections.Add(section1); report1.ReportSettings.PrintJobDescription = "filename"; this.xamReportPreview1.GeneratePreview(report1, false, false); }
If setting the PrintJobDescription doesn't work for you, please send me a sample that reproduces the issue you have so that I may look into what is happening. Or if my sample doesn't work correctly for you, let me know what version of our controls you are using.
Let me know if you have any questions.
1588.ReportViewer.zip
Hi Alan,
This worked!
Thank you very much!