Free Support Forum -

Text formatting within a cell

I am trying to create a new line within a cell, how do I do it in code. I am trying to simulate ALT + ENTER in Excel programatically. Thanks.

You can try this:



I tried it and the cell still does not format correctly. Where there should be carriage returns, there are little square boxes as if Excel does not recognize the \n carriage return symbol. When I select the cell, the text is properly formatted in the Formula textbox but not in the cell itself. Let me know a way around this. I think I am close.


Hi Jean,

Sorry I forget to add an extra information. When you set the \n character, please set wraptext style for this cell.

cell.Style.IsTextWrapped = true