문제

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