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


      <FONT size=2>


    fpSpread2.Sheets[0].Cells[5, currColumnIndex].Text = fpSpread2.Sheets[0].Cells[5, currColumnIndex].Text +  </FONT><FONT color=#800000 size=2>"      " + pid[0];</FONT>


    <FONT color=#800000>I want a text to appear the following way in the same cell</FONT>


    <FONT color=#800000>Computer</FONT>


    <FONT size=2><FONT color=#800000>AAAAAA  </FONT></FONT>


    <FONT size=2><FONT color=#800000>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</FONT></FONT>


    <FONT size=2><FONT color=#800000></FONT></FONT> 


    <FONT size=2><FONT color=#800000>Thanks</FONT></FONT>


    <FONT size=2><FONT color=#800000>Droopy</FONT>

    </FONT>
  • 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".

    <FONT size=2>

    FarPoint.Win.Spread.CellType.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>GeneralCellType</FONT></FONT><FONT size=2> g = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> FarPoint.Win.Spread.CellType.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>GeneralCellType</FONT></FONT><FONT size=2>();


    g.WordWrap = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;


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


    fpSpread1.Sheets[0].Cells[1, 1].Value = </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Computer\n\rAAAAA"</FONT></FONT><FONT size=2>;


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

    </FONT>
Need extra support?

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

Learn More

Forum Channels