Report.ExcelLayout(Integer, InStream) Method

Version: Available or changed with runtime version 9.0.

Gets the Excel layout that is used on a report and returns it as a data stream.

Syntax

[Ok := ]  Report.ExcelLayout(Number: Integer, InStream: InStream)

Parameters

Number
 Type: Integer
The ID of the report object for which you want to get the Excel layout.

InStream
 Type: InStream
The variable in which to return the Excel layout.

Return Value

[Optional] Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

Using the return value is optional. When you use the return value, if the Excel layout can't be retrieved at runtime, then the system returns false and no error is recorded. When you omit the return value, if the Excel layout can't be retrieved at runtime, then an error occurs, which states that the layout couldn't be retrieved.

Example

The Report.ExcelLayout method will throw a runtime error if the operation fails, either if no object exists with that object ID or if no Excel layout exists for that report. This code example shows how to write robust AL code to handle possible failures.

var
    layoutAsStream: InStream;
    result: Boolean;
begin
    result := Report.ExcelLayout(ObjectId, layoutAsStream);
    if result then begin
        // use the layout that now is available in the stream
    end
    else
        // handle that no object exists with that id or that no Excel layout exists for that report
    ;
end;

See also

Report Data Type
Get Started with AL
Developing Extensions