Skip to main content

TextDocument.Write

Write

Syntax variant: To a file

Syntax

Write(<FileName>, <FileType>, <LineSeparator>)

Parameters

<FileName> (required)

Type: String. File name for saving text.

<FileType> (optional)

Type: TextEncoding, String. File encoding type. You can specify the file type both as the TextEncoding enumeration value and as a line. Supported names of codings:

  • UTF-8
  • UTF-16
  • UTF-16BE
  • UTF-16LE
  • UTF-32
  • UTF-32BE
  • UTF-32LE
  • UTF16_PlatformEndian
  • UTF16_OppositeEndian
  • UTF32_PlatformEndian
  • UTF32_OppositeEndian
  • UTF-7
  • IMAP-mailbox-name
  • SCSU
  • BOCU-1
  • CESU-8
  • ISO-8859-1
  • US-ASCII
  • gb18030
  • IBM367
  • iso-8859-2
  • iso-8859-3
  • iso-8859-4
  • iso-8859-5
  • iso-8859-6
  • iso-8859-7
  • iso-8859-8
  • iso-8859-9
  • iso-8859-13
  • iso-8859-15
  • cp932
  • Shift_JIS
  • EUC-JP
  • cp33722
  • windows-950
  • Big5
  • cp950
  • Big5-HKSCS
  • cp1386
  • GBK
  • GB2312
  • GB_2312-80
  • cp964
  • cp949
  • cp949c
  • EUC-KR
  • ibm-971
  • KSC_5601
  • ibm-1363
  • windows-949
  • windows-874
  • cp874
  • ibm-1162
  • cp437
  • cp737
  • cp775
  • cp850
  • cp851
  • cp852
  • cp855
  • cp856
  • cp857
  • cp858
  • cp860
  • cp861
  • cp862
  • cp863
  • cp864
  • cp865
  • cp866
  • ibm-867
  • CP868
  • cp869
  • KOI8-R
  • ibm-901
  • ibm-902
  • cp922
  • KOI8-U
  • ibm-4909
  • windows-1250
  • windows-1251
  • windows-1252
  • windows-1253
  • windows-1254
  • windows-1255
  • windows-1256
  • windows-1257
  • windows-1258
  • macintosh
  • x-mac-greek
  • x-mac-cyrillic
  • x-mac-centraleurroman
  • x-mac-turkish
  • hp-roman8
  • Adobe-Standard-Encoding
  • cp1006
  • cp1098
  • cp1124
  • cp1125
  • ibm-1129
  • cp1131
  • ibm-1133
  • ISO-2022-JP
  • JIS_Encoding
  • ISO-2022-JP-2
  • ISO_2022,locale=ja,version=3
  • ISO_2022,locale=ja,version=4
  • ISO-2022-KR
  • ISO_2022,locale=ko,version=1
  • ISO-2022-CN
  • ISO-2022-CN-EXT
  • HZ-GB-2312
  • windows-57002
  • windows-57003
  • windows-57011
  • windows-57010
  • windows-57007
  • windows-57004
  • windows-57005
  • windows-57008
  • windows-57009
  • LMBCS-1
  • LMBCS-2
  • LMBCS-3
  • LMBCS-4
  • LMBCS-5
  • LMBCS-6
  • LMBCS-8
  • LMBCS-11
  • LMBCS-16
  • LMBCS-17
  • LMBCS-18
  • LMBCS-19
  • IBM037
  • ebcdic-de
  • ebcdic-dk
  • IBM278
  • IBM280
  • IBM284
  • IBM285
  • IBM290
  • IBM297
  • IBM420
  • IBM424
  • IBM500
  • ibm-803
  • IBM-Thai
  • IBM870
  • IBM871
  • cp875
  • IBM918
  • cp930
  • cp933
  • cp935
  • cp937
  • cp939
  • cp1025
  • IBM1026
  • IBM1047
  • cp1097
  • cp1112
  • cp1122
  • cp1123
  • ibm-1130
  • ibm-1132
  • ibm-1137
  • IBM01140
  • IBM01141
  • IBM01142
  • IBM01143
  • IBM01144
  • IBM01145
  • IBM01146
  • IBM01147
  • IBM01148
  • IBM01149
  • ibm-1153
  • ibm-1154
  • ibm-1155
  • ibm-1156
  • ibm-1157
  • ibm-1158
  • ibm-1160
  • ibm-1164
  • ibm-1364
  • ibm-1371
  • ibm-1388
  • ibm-1390
  • ibm-1399
  • ibm-5123
  • ibm-8482
  • ibm-16684
  • ibm-4899
  • ibm-4971
  • ebcdic-he
  • ebcdic-ar
  • ibm-37_P100-1995,swaplfnl
  • ibm-1047_P100-1995,swaplfnl
  • ibm-1140_P100-1997,swaplfnl
  • ibm-1142_P100-1997,swaplfnl
  • ibm-1143_P100-1997,swaplfnl
  • ibm-1144_P100-1997,swaplfnl
  • ibm-1145_P100-1997,swaplfnl
  • ibm-1146_P100-1997,swaplfnl
  • ibm-1147_P100-1997,swaplfnl
  • ibm-1148_P100-1997,swaplfnl
  • ibm-1149_P100-1997,swaplfnl
  • ibm-1153_P100-1999,swaplfnl
  • ibm-12712_P100-1998,swaplfnl
  • ibm-16804_X110-1999,swaplfnl
  • ebcdic-xml-us

Default value: UTF8.

<LineSeparator> (optional)

Type: String. A line is set that is used as a line separator; the symbol LF will be converted to this separator during writing the file. If the line is empty, then line separators are not converted on write. Some examples of valid string delimiters:

  • CR;
  • LF;
  • CR + LF (the default value, can be omitted).

If any other strings are used as string delimiters, an exception is generated. Default value: CR + LF.

Description of method variant

Writing of a text document to a file.

Syntax variant: To a stream

Syntax

Write(<Stream>, <FileType>, <LineSeparator>, <WriteBOM>)

Parameters

<Stream> (required)

Type: Stream, MemoryStream, FileStream. Stream for writing a document.

<FileType> (optional)

Type: TextEncoding, String. Specifies the text encoding type. The file type can be set both as the TextEncoding enum value and as a string, indicating the coding name. Supported names of codings:

  • UTF-8
  • UTF-16
  • UTF-16BE
  • UTF-16LE
  • UTF-32
  • UTF-32BE
  • UTF-32LE
  • UTF16_PlatformEndian
  • UTF16_OppositeEndian
  • UTF32_PlatformEndian
  • UTF32_OppositeEndian
  • UTF-7
  • IMAP-mailbox-name
  • SCSU
  • BOCU-1
  • CESU-8
  • ISO-8859-1
  • US-ASCII
  • gb18030
  • IBM367
  • iso-8859-2
  • iso-8859-3
  • iso-8859-4
  • iso-8859-5
  • iso-8859-6
  • iso-8859-7
  • iso-8859-8
  • iso-8859-9
  • iso-8859-13
  • iso-8859-15
  • cp932
  • Shift_JIS
  • EUC-JP
  • cp33722
  • windows-950
  • Big5
  • cp950
  • Big5-HKSCS
  • cp1386
  • GBK
  • GB2312
  • GB_2312-80
  • cp964
  • cp949
  • cp949c
  • EUC-KR
  • ibm-971
  • KSC_5601
  • ibm-1363
  • windows-949
  • windows-874
  • cp874
  • ibm-1162
  • cp437
  • cp737
  • cp775
  • cp850
  • cp851
  • cp852
  • cp855
  • cp856
  • cp857
  • cp858
  • cp860
  • cp861
  • cp862
  • cp863
  • cp864
  • cp865
  • cp866
  • ibm-867
  • CP868
  • cp869
  • KOI8-R
  • ibm-901
  • ibm-902
  • cp922
  • KOI8-U
  • ibm-4909
  • windows-1250
  • windows-1251
  • windows-1252
  • windows-1253
  • windows-1254
  • windows-1255
  • windows-1256
  • windows-1257
  • windows-1258
  • macintosh
  • x-mac-greek
  • x-mac-cyrillic
  • x-mac-centraleurroman
  • x-mac-turkish
  • hp-roman8
  • Adobe-Standard-Encoding
  • cp1006
  • cp1098
  • cp1124
  • cp1125
  • ibm-1129
  • cp1131
  • ibm-1133
  • ISO-2022-JP
  • JIS_Encoding
  • ISO-2022-JP-2
  • ISO_2022,locale=ja,version=3
  • ISO_2022,locale=ja,version=4
  • ISO-2022-KR
  • ISO_2022,locale=ko,version=1
  • ISO-2022-CN
  • ISO-2022-CN-EXT
  • HZ-GB-2312
  • windows-57002
  • windows-57003
  • windows-57011
  • windows-57010
  • windows-57007
  • windows-57004
  • windows-57005
  • windows-57008
  • windows-57009
  • LMBCS-1
  • LMBCS-2
  • LMBCS-3
  • LMBCS-4
  • LMBCS-5
  • LMBCS-6
  • LMBCS-8
  • LMBCS-11
  • LMBCS-16
  • LMBCS-17
  • LMBCS-18
  • LMBCS-19
  • IBM037
  • ebcdic-de
  • ebcdic-dk
  • IBM278
  • IBM280
  • IBM284
  • IBM285
  • IBM290
  • IBM297
  • IBM420
  • IBM424
  • IBM500
  • ibm-803
  • IBM-Thai
  • IBM870
  • IBM871
  • cp875
  • IBM918
  • cp930
  • cp933
  • cp935
  • cp937
  • cp939
  • cp1025
  • IBM1026
  • IBM1047
  • cp1097
  • cp1112
  • cp1122
  • cp1123
  • ibm-1130
  • ibm-1132
  • ibm-1137
  • IBM01140
  • IBM01141
  • IBM01142
  • IBM01143
  • IBM01144
  • IBM01145
  • IBM01146
  • IBM01147
  • IBM01148
  • IBM01149
  • ibm-1153
  • ibm-1154
  • ibm-1155
  • ibm-1156
  • ibm-1157
  • ibm-1158
  • ibm-1160
  • ibm-1164
  • ibm-1364
  • ibm-1371
  • ibm-1388
  • ibm-1390
  • ibm-1399
  • ibm-5123
  • ibm-8482
  • ibm-16684
  • ibm-4899
  • ibm-4971
  • ebcdic-he
  • ebcdic-ar
  • ibm-37_P100-1995,swaplfnl
  • ibm-1047_P100-1995,swaplfnl
  • ibm-1140_P100-1997,swaplfnl
  • ibm-1142_P100-1997,swaplfnl
  • ibm-1143_P100-1997,swaplfnl
  • ibm-1144_P100-1997,swaplfnl
  • ibm-1145_P100-1997,swaplfnl
  • ibm-1146_P100-1997,swaplfnl
  • ibm-1147_P100-1997,swaplfnl
  • ibm-1148_P100-1997,swaplfnl
  • ibm-1149_P100-1997,swaplfnl
  • ibm-1153_P100-1999,swaplfnl
  • ibm-12712_P100-1998,swaplfnl
  • ibm-16804_X110-1999,swaplfnl
  • ebcdic-xml-us

<LineSeparator> (optional)

Type: String. A line is set that is used as a line separator; the symbol LF will be generated from this separator during reading the file. If the line is empty, then line separators are not converted on read. Some examples of valid string delimiters:

  • CR;
  • LF;
  • CR + LF (the default value, can be omitted).

If any other strings are used as string delimiters, an exception is generated. Default value: CR + LF.

<WriteBOM> (optional)

Type: Boolean. Defines whether the byte order mark (BOM) is added when the document is saved. Default value: False.

Description of method variant

Writing of a text document to a stream.

Description

Writes a text document to a file with the specified name.

Availability

Thin client, web-client, server, thick client, external connection.

Note

When working on the web-client method execution calls the server.

Example

DocText.Write("price.txt");

See also

TextDocument, method WriteAsync TextDocument, method BeginWriting

Translation

Русская версия: ТекстовыйДокумент.Записать (TextDocument.Write)