{"title":"Report.SaveAsWord(Text) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/report/reportinstance-saveasword-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-saveasword-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-saveasword-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":"Saves a report on the computer that is running the server as a Microsoft Word (.doc) document.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Report.SaveAsWord(Text) Method","slug":"reportsaveaswordtext-method","at":0,"chars":3481},{"level":2,"title":"Syntax","slug":"syntax","at":260,"chars":64},{"level":2,"title":"Parameters","slug":"parameters","at":324,"chars":352},{"level":2,"title":"Return Value","slug":"return-value","at":676,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":914,"chars":1644},{"level":3,"title":"Error conditions","slug":"error-conditions","at":1746,"chars":812},{"level":2,"title":"Example","slug":"example","at":2558,"chars":789},{"level":2,"title":"Related information","slug":"related-information","at":3347,"chars":134}],"text":"# Report.SaveAsWord(Text) Method\n> Version: _Available or changed with runtime version 1.0._\nSaves a report on the computer that is running the server as a Microsoft Word (.doc) document.\n> NOTE\n> This method is supported only in Business Central on-premises.\n## Syntax\n```al\n[Ok := ]  Report.SaveAsWord(FileName: Text)\n```\n## Parameters\nReport\nType: report-data-type\nAn instance of the report-data-type data type.\nFileName\nType: ../text/text-data-type\nThe path and the name of the file that you want to save the report as. The path must exist, the file must not be being used, and the server process must have permission to write to the file. Otherwise, you will get errors.\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\nThe SaveAsWord method can be used on the Report data type and on Report variables. When you are programming the SaveAsWord method, if you do not know the specific report that you want to run, then use the static version of the SaveAsWord method, see Report.SaveAsWord(Integer, Text [, var Record])<report-saveasword-method>.\nWhen you call the SaveAsWord method, the report is generated and saved to the file specified in \"FileName.\" The request page is not shown.\n> NOTE\n> The FileName parameter specifies a location on the computer that is running Business Central. If you call this method from a client, such as from an action on a page, then use the ../file/file-download-method method to download the .pdf file from the computer that is running the Business Central server to the computer that is running the client.\n### Error conditions\nThe method can fail in the following three ways:\n If the destination folder specified in FileName does not exist,\n If the file specified in FileName is being used, or\n If the Business Central server process does not have permission to write to the file specified in FileName.\nIf the destination folder that you specify in FileName does not exist, then you get the following error: The specified path is invalid.\nIf the file that you specify in FileName is being used, then you get the following error: An I/O exception occurred during the operation.\nIf the Business Central server process does not have permission to write to the file that you specify in FileName, then you get the following error: Either the caller does not have the required permission or the specified path is read-only.\n## Example\nThis example shows how to use the static SaveAsWord method in a safe way (where no errors occur).\n```al\nvar\n    FileNameAndPath: Text[250];\n    MyReportInstance: Report::MyReport\nbegin\n    // setup that FileNameAndPath is valid to write to\n\n    MyReportInstance.SaveAsWord(FileNameAndPath);\nend;\n```\nFor a full example that shows how to use any of the Report.SaveAs* methods (SaveAsExcel, SaveAsHtml, SaveAsPDF, SaveAsWord, or SaveAsXML) to generate the report in the Business Central server and then write the report output to a file, see Report.SaveAsExcel(FileName: Text)<report-saveasexcel-method>.\nYou can create an action on a page and set the action to run this code. When you run the action, the Export File dialog box opens. Choose Save to save the file to the client.\n## Related information\nreport-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}