How do I put a carriage return in a cell?
Currently I tried this: String.Format("{0}\r\nLabor Category", contract.Agency.Name);But it just butts the string together.
Thanks
Hi,
in Excel pressing Alt + Enter inserts what is called a Line Feed character. This automatically sets the “Warp text” option on the format of the cell.
When you’ve exported to Excel you’ve set the line feed character ("Line 1" + (char)10 + "Line 2"), but the “warp text” of these cells is not set. That’s why the strings look “butted”. To prove that you can try to open the excel file and put the cell with “butted” content in edit mode. Then leave the cell and Excel will set the Warp mode and it will warp the contents.