I want to set the witdh of a cell in my ExcelSheet.
Set the witdh:
worksheet.Columns["K"].ColumnWidth = 114.80;
When the text is larger then the ColumnWith the text is not visible.
I want to split the text to a new row in the same cell based on the ColumnWith.
I tried to add \r\n to the string in the Excel but no result.
EDIT after answers
This works perfectly:
worksheet.Columns["K"].ColumnWidth = 114;
Excel.Range rangeK = worksheet.get_Range("K1");
rangeK.EntireColumn.WrapText = true;
What you are looking for is this:
That code, for example, will set the cells from K1 to K100 to wrap the contents inside their cells.