سؤال

I have a ReportBuilder report that preview's as expected. I'm trying to save it to pdf with the following code taken from the documentation:

ppReport1.ShowPrintDialog := false;
ppReport1.DeviceType := dtPDF;
ppReport1.TextFileName := 'C:\temp\report.pdf';
ppReport1.Print;

I get a glimpse of an dialog on the screen, stating that it outputs a couple of pages to the given file, but the file is no where to be found on disk.

What have I missed?

هل كانت مفيدة؟

المحلول

So, Process Monitor showed me that the file was written, but then deleted. After a lot of source code browsing, I found the cause of this.

There is a property under EmailSettings called DeleteFile. For some reason, it also effects printing to file.

نصائح أخرى

Try checking this property:

ppReport1.AllowPrintToFile := True;

It works fine with me.

It's strange. I just use by this way:

  ppReport1.AllowPrintToFile := True;
  ppReport1.ShowPrintDialog  := False;
  ppReport1.DeviceType       := 'PDF';
  ppReport1.TextFileName     := 'C:\temp\report.pdf';
  ppReport1.Print;

(I'm using it on ReportBuilder v14.07)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top