how to split text within the same cell into two line

Posted by: droopy5 on 8 September 2017, 1:23 pm EST

  • Posted 8 September 2017, 1:23 pm EST

    Hi


     


    fpSpread2.Sheets[0].Cells[5, currColumnIndex].Text = fpSpread2.Sheets[0].Cells[5, currColumnIndex].Text +  "      " + pid[0];


    I want a text to appear the following way in the same cell


    Computer


    AAAAAA 


    i.e....2 separate lines within the same cell.....when i use the above code,it doesnt work properly..the first line flows into the second line.How do i prevent this??.Am using C# coding


     


    Thanks


    Droopy

  • Replied 8 September 2017, 1:23 pm EST

    Droopy,


    You need to turn on the WordWrap property for the CellType object in the cell and delimit your different lines of text with "\n\r".


    FarPoint.Win.Spread.CellType.GeneralCellType g = new FarPoint.Win.Spread.CellType.GeneralCellType();


    g.WordWrap = true;


    fpSpread1.Sheets[0].Cells[1, 1].CellType = g;


    fpSpread1.Sheets[0].Cells[1, 1].Value = "Computer\n\rAAAAA";


    fpSpread1.Sheets[0].Rows[1].Height = 30;

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels