The following example executes a report binder, saves the output as a PDF file or Microsoft Word document and opens the file in the default document viewer.



Code Sample



# Set the file format to DOCX/PDF.

$fileformat = "DOCX";

$reportBinderIdentifier = [Guid]"0f22bce4-7428-4a11-84a5-9e23abfbcb71";


# Generate the execution settinsg.

$executionSettings = $reporting.DO_CreateReportBinderExecutionSettings($reportBinderIdentifier);


# Optionally set the customer or container.

$executionSettings.ContainerId = 1000;


# Execute the report binder.

$documentPackage = $reporting.DO_ExecuteReportBinder($executionSettings, $fileformat);


# Save and open the file.

$filename = "$($env:TEMP)\$($documentPackage.Filename)"

[IO.File]::WriteAllBytes($filename, $documentPackage.FileData);

[System.Diagnostics.Process]::Start($filename); 




For information about setting report parameters see the Execute a Report (Advanced) example.