C# Excel interop, put a line break in the text of a cell in a Excel

Thanushka picture Thanushka · Dec 23, 2011 · Viewed 36.5k times · Source

I am writing an Excel sheet using interop. In the sheet I need to put a set of sentences in to a cell. The text should be in a line break manner. How can I achieve this?

Thanks in advance.

Answer

Thanushka picture Thanushka · Dec 28, 2011

It was done by either entering "\r\n" or Environment.NewLine. And also must remember to make WrapText property true in order to make the line breaks visible.