Skip to main content
12-Amethyst
September 3, 2019
Solved

Line Break/Return in FileRepository

  • September 3, 2019
  • 5 replies
  • 2532 views

Hi,

I'm developing some functions with FileRepository.

I'm writing some lines of text into a .txt file.

I tried service of CreateTextFile & AppendToTextFile, with them all text will be written into same 1 line, no matter '/n /r \n \r' are included or not.

For example, I want to show:

Line 1

Line 2

Line 3

and it always shows:

Line 1Line 2Line 3

 

Any advise?

Best answer by Constantine

Hello,

 

\n works for me:

 Things["SystemRepository"].CreateTextFile({
	path: 'Test.txt',
	data: 'line1\nline2\nline3',
	overwrite: true
});

Can you provide sample code where it doesn't?

 

/ Constantine

5 replies

16-Pearl
September 3, 2019

@tallrain  Can you try using <br>?

Please refer to this post for more information.

 

Thanks,

Vibhuti

tallrain12-AmethystAuthor
12-Amethyst
September 3, 2019

Thank you, but it's not working.

18-Opal
September 3, 2019

Hello,

 

\n works for me:

 Things["SystemRepository"].CreateTextFile({
	path: 'Test.txt',
	data: 'line1\nline2\nline3',
	overwrite: true
});

Can you provide sample code where it doesn't?

 

/ Constantine