{"title":"Report.SaveAs(Text, ReportFormat, var OutStream [, RecordRef]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/report/reportinstance-saveas-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/report/reportinstance-saveas-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/report/reportinstance-saveas-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Runs a specific report without a request page and saves the report as a PDF, Excel, Word, or XML file.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Report.SaveAs(Text, ReportFormat, var OutStream [, RecordRef]) Method","slug":"reportsaveastext-reportformat-var-outstream-recordref-method","at":0,"chars":2691},{"level":2,"title":"Syntax","slug":"syntax","at":434,"chars":135},{"level":2,"title":"Parameters","slug":"parameters","at":569,"chars":664},{"level":2,"title":"Return Value","slug":"return-value","at":1233,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":1471,"chars":1086},{"level":3,"title":"Error conditions","slug":"error-conditions","at":2374,"chars":183},{"level":2,"title":"Related information","slug":"related-information","at":2557,"chars":134}],"text":"# Report.SaveAs(Text, ReportFormat, var OutStream [, RecordRef]) Method\n> Version: _Available or changed with runtime version 1.0._\nRuns a specific report without a request page and saves the report as a PDF, Excel, Word, or XML file. Instead of using the request page to obtain parameters at runtime, the method gets the parameter values as an input parameter string, typically from the return value of a RunRequestPage method call.\n## Syntax\n```al\n[Ok := ]  Report.SaveAs(Parameters: Text, Format: ReportFormat, var OutStream: OutStream [, RecordRef: RecordRef])\n```\n## Parameters\nReport\nType: report-data-type\nAn instance of the report-data-type data type.\nParameters\nType: ../text/text-data-type\nA string of request page parameters as XML to use to run the report. The parameter string is retrieved from the return value a RunRequestPage method call.\nFormat\nType: ../reportformat/reportformat-option\nThe type of file to save the report as. The following options are supported: Pdf, Excel, Word, and XML.\nOutStream\nType: ../outstream/outstream-data-type\nThe stream to which to write a report.\n*[Optional] RecordRef*\nType: ../recordref/recordref-data-type\nThe RecordRef that refers to the table in which you want to find a record.\n## Return Value\n*[Optional] Ok*\nType: ../boolean/boolean-data-type\ntrue 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.\n## Remarks\nYou typically use this method together with the reportinstance-runrequestpage-method method. The RunRequestPage method runs a report request page without actually running the report, but instead, it returns the parameters that are set on the request page as a string. You can then call the SaveAs method to get the parameter string and save the report to a file of the specified format.\nFor a simple example that illustrates how to use the SaveAs method, see the example in the reportinstance-runrequestpage-method method topic.\n> NOTE\n> By default, when a report uses an RDL report layout at runtime, fonts are embedded in the generated PDF. You can specify whether fonts are embedded in the PDF for RDL reports by changing the Report PDF Font Embedding setting in the Dynamics 365 Business Central service instance configuration or changing the PDFFontEmbedding property in report objects.\n### Error conditions\nThe method can fail in the following ways:\n If the string of request page parameters as XML specified in \"Parameters\" can't be parsed as valid request page data.\n## Related information\nreport-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}