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";


# Execute the report binder.

$documentPackage = $reporting.DO_ExecuteReportBinderBasic($reportBinderIdentifier, $fileformat);


# Save and open the file.

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

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

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