TextWriter in Write Line Activity

Hello,

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

WriteLine

Thanks

1 Like

Hi
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 ?

Hi
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 - TextWriter Class (System.IO) | Microsoft Learn

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.

@Palaniyappan
what is the difference between your answer and UiPath document portal description.

I don’t get your point clearly. Instead of using a StreamWriter object and storing the text to a file, we can use write text activity right? What is the difference between write text file and Text writer?