Search code examples
c#excelcom-interop

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


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.


Solution

  • 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.