TextWriter in Write Line Activity


What’s the use of “TextWriter” in WriteLine activity under Misc category?



1 Like

welcome to uipath community
TextWriter - Its Optional. Sends the content in the Text property to a target different from the default Output panel.

Cheers @mbs2

What should be the VB Expression inside the textwriter ?

Hi @Palaniyappan,

What should be the VB Expression inside the textwriter ?

Kindly have a view on this

Cheers @Loongwang

Hi @mbs2, @Loongwang, @VamsiGoli

WriteLine activity in uipath is to write text in output panel by default. If you have any requirement to write any other source most probably a file, You can just use this TextWriter Property.

WriteLine Properties

  1. Text - The string value which you are going to print in console output or other source
  2. TextWriter - By default if it is empty it writes in output panel, else you can mention your file name by means of streamwriter object.

Reference - https://docs.microsoft.com/en-us/dotnet/api/system.io.textwriter?view=netcore-3.1

From the above image,

  1. A TextWriter abstract class object is declared & extended by defining a streamwriter object with the file path in it.
  2. After the write line we need to either flush/close the streamwriter - as given in the invoke method, to make sure your text gets saved in the file.

Output - It will generate a file if not present or use existing file to write the text you have given in writeline.