{"title":"File.TextMode([Boolean]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-textmode-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/file/file-textmode-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/file/file-textmode-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":"Sets whether a file should be opened as an ASCII file or a binary file.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"File.TextMode([Boolean]) Method","slug":"filetextmodeboolean-method","at":0,"chars":1716},{"level":2,"title":"Syntax","slug":"syntax","at":290,"chars":208},{"level":2,"title":"Parameters","slug":"parameters","at":498,"chars":138},{"level":2,"title":"Return Value","slug":"return-value","at":636,"chars":73},{"level":2,"title":"Remarks","slug":"remarks","at":709,"chars":158},{"level":2,"title":"Example","slug":"example","at":867,"chars":717},{"level":2,"title":"Related information","slug":"related-information","at":1584,"chars":132}],"text":"# File.TextMode([Boolean]) Method\n> Version: _Available or changed with runtime version 1.0._\nSets whether a file should be opened as an ASCII file or a binary file. Gets the current setting of this option for a file.\n> NOTE\n> This method is supported only in Business Central on-premises.\n## Syntax\n```al\n[Textmode := ]  File.TextMode([Mode: Boolean])\n```\n> NOTE\n> This method can be invoked using property access syntax.\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Parameters\nFile\nType: file-data-type\nAn instance of the file-data-type data type.\n*[Optional] Mode*\nType: ../boolean/boolean-data-type\n## Return Value\n*[Optional] Textmode*\nType: ../boolean/boolean-data-type\n## Remarks\nThis method should be used before File.Open is used to open the file. If you use this method on a file that is already open, then an error occurs.\n## Example\nThe following example sets the TextMode to true when the file is open for writing. This means the file contents will be written to a text file that is named 'C:\\\\TestFolder\\\\TestFile.txt' by using ASCII characters. The file-writemode-method and the file-open-method open the file for writing and the text 'Hello World' is written. The file-close-method closes the file after the file is written to. This example assumes that you have created a text file that is named C:\\\\TestFolder\\\\TestFile.txt.\n```al\nvar\n    TestFile: File;\nbegin\n    TestFile.TextMode(True);\n    TestFile.WriteMode(True);\n    TestFile.Open('C:\\TestFolder\\TestFile.txt');\n    TestFile.Write('Hello World');\n    TestFile.Close;\nend;\n```\n## Related information\nfile-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}