{"title":"OutStream.Write(TextConst [, Integer]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/outstream/outstream-write-textconst-integer-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/outstream/outstream-write-textconst-integer-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/outstream/outstream-write-textconst-integer-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":"Writes a specified number of bytes to the stream.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":144,"chars":89},{"level":2,"title":"Parameters","slug":"parameters","at":233,"chars":430},{"level":2,"title":"Return Value","slug":"return-value","at":663,"chars":227},{"level":2,"title":"Example","slug":"example","at":890,"chars":338},{"level":2,"title":"Related information","slug":"related-information","at":1228,"chars":137}],"text":"> Version: _Available or changed with runtime version 3.0._\nWrites a specified number of bytes to the stream. Data is written in binary format.\n## Syntax\n```al\n[Written := ]  OutStream.Write(Value: TextConst [, Length: Integer])\n```\n## Parameters\nOutStream\nType: outstream-data-type\nAn instance of the outstream-data-type data type.\nValue\nType: ../textconst/textconst-data-type\nContains the data to be written.\n*[Optional] Length*\nType: ../integer/integer-data-type\nThe number of bytes to be written. In the case of data types other than string, code, and binary, if you specify a length that differs from the size of the variable, an error message is displayed.\n## Return Value\n*[Optional] Written*\nType: ../integer/integer-data-type\nThe number of bytes that were written. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.\n## Example\nThis example requires that you create the following variables.\n```al\n var\n    recBinaries: Record \"Company Information\";\n    OStream: OutStream;\n    TxtConst: Label 'Hello World';\nbegin\n    recBinaries.Find('-');\n    recBinaries.Picture.CreateOutstream(OStream);\n    OStream.Write(TxtConst);\n    recBinaries.Modify();\nend;\n```\n## Related information\noutstream-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}