Microsoft Dynamics NAV Documentation
SAVEASEXCEL Function (REPORT)

Saves a report as a Microsoft Office Excel file.

[Ok :=] Report.SAVEASEXCEL(Number, FileName[, Record])
[Ok :=] Report.SAVEASEXCEL(FileName)

Parameters

Number

Type: Integer

The ID of the report that you want to run. You can click View, and then click C/AL Symbol Menu to select the report from a list.

If the report you specify does not exist, a run-time error occurs.

FileName

Type: Text

The path to and the name of the file that you want to save the report as.

Record

Type: Tecord

Specifies which record to use in the report. Any filters that have been applied to the record that you specify will be used.

Property Value/Return Value

Type: Boolean

If you omit this optional return value, a run-time error occurs if the record cannot be found. If you include a return value, it is assumed that you will handle any errors.

true if the report was saved; otherwise, false.

Remarks

The SAVEASEXCEL function can be used on the Report type and on Report variables, like the SAVEASHTML Function (REPORT).

When SAVEASEXCEL is called, the report is generated and saved to "FileName." A Saving to Excel window is displayed, which shows the progress of the process. If you click Cancel, the report will not be generated or saved as an Excel file. Note that the Request Form will not be shown.

The return value informs you whether the report has been saved successfully. If you use this value and an error occurs, false is returned. If you do not use the return value, the occurrence of an error results in an error message such as "Out of hard disk space", "The file parameter is not open", and so on. The object is then closed.

See Also

Reference

Report Data Type

Tags :


Community Content

Prerequisite
Prerequisites
SAVEASEXCEL (and SAVEASPDF) can be only used if ...
  1. the database is run together with the RTC and
  2. a Visual Studio layout exists for the report you want to save.
Tags :

Page view tracker