Printing a report in a PDF, Excel, and Word format
Sharing recorded information is very important in our day-to-day activities; having the same format for the shared information is very important. If clients want to send a purchase order to a vendor, they will prefer to do so in a PDF format, or if the management wants to do some further analysis on a report's data, it will prefer Excel. Let's see how to do this.
How to do it...
Let's create a new codeunit from Object Designer.
Add the following global variables:
Name
Type
Subtype
Length
FileName
Text
250
Customer
Rec
Customer
Add the following code in the
OnRun
trigger:Customer.setrange(City,' London'); //Export to PDF FileName := 'C:\NAVReports\CuatomerList.pdf'; REPORT.SAVEASPDF(101, FileName,Customer); //Export to Excel FileName := 'C:\NAVReports\CustomerList.xls'; REPORT.SAVEASPDF(101, FileName,Customer); //Export to Word FileName := 'C:\NAVReports\CustomerList.doc'; REPORT.SAVEASPDF(101, FileName,Customer);
Save and close the...