# File.TextMode([Boolean]) Method
> Version: _Available or changed with runtime version 1.0._
Sets whether a file should be opened as an ASCII file or a binary file. Gets the current setting of this option for a file.
> NOTE
> This method is supported only in Business Central on-premises.
## Syntax
```al
[Textmode := ]  File.TextMode([Mode: Boolean])
```
> NOTE
> This method can be invoked using property access syntax.
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
File
Type: file-data-type
An instance of the file-data-type data type.
*[Optional] Mode*
Type: ../boolean/boolean-data-type
## Return Value
*[Optional] Textmode*
Type: ../boolean/boolean-data-type
## Remarks
This 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.
## Example
The 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.
```al
var
    TestFile: File;
begin
    TestFile.TextMode(True);
    TestFile.WriteMode(True);
    TestFile.Open('C:\TestFolder\TestFile.txt');
    TestFile.Write('Hello World');
    TestFile.Close;
end;
```
## Related information
file-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

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. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/file/file-textmode-method/
