This project is read-only.

How to Multi-line in one cell?

Nov 11, 2010 at 2:10 AM

 

Hi All,

    I could use "Alt+Enter" to buile a multi-line string in one cell using Excel.

    [C#]  

    My Program Process =  Data ->GridView -> NPOI -> Excel    

    Now I try to Add "\r\n" or Envirment.NewLine into the cell,

    but After I Save to excel from gridview, It can't auto display multi-line effect.

    Below is my code

    1) Data -> GridView

    GridView.Rows.Add( .. )

    2) GridView ->Excel

    HSSFRow.CreateCell(ColumnIndex).SetCellValue( GridView Cell String).

  

    Should I set some cell style or do something ?

   

    Thanks very much.

 

Dec 9, 2010 at 2:28 AM

you can use

 style.WrapText=true

if excel cell data have Envirment.NewLine ,you will get multi line cell.

Beaver