Share via


Excel Interop line break in cell

Question

Wednesday, July 25, 2012 9:23 PM

Using get_range to enter a string value to a cell, how do I enter a line break (ie. the equivalent of "alt-enter") to break a line of text in a cell without leaving the cell?

All replies (3)

Thursday, July 26, 2012 9:36 AM âś…Answered

Refer this link:

http://stackoverflow.com/questions/5819168/c-sharp-export-to-excel-replace-br-with-a-line-break-in-a-cell

http://stackoverflow.com/questions/8613850/c-sharp-excel-interop-put-a-line-break-in-the-text-of-a-cell-in-a-excel

http://stackoverflow.com/questions/1176548/how-to-insert-programmatically-a-new-line-in-an-excel-cell-in-c

Sivalingam


Wednesday, July 25, 2012 10:18 PM

did u try using char 10 / 13.

            string str = "Hello" + (char)10 + "World";
            string str1 ="Hello 13" + (char)13 + "World";

--Krishna


Thursday, July 26, 2012 3:24 AM

Can you show your existing code?

chanmm

chanmm