Carriage Return within a Cell -> Save to Excel

Posted by: craigreillyvideowestinc-com on 8 September 2017, 3:23 pm EST

    • Post Options:
    • Link

    Posted 8 September 2017, 3:23 pm EST

    A have tried several variables.

    Example Cell Text:

    Text & vbCrLf & Text

    Text & Chr(10) & Text

    etc…

    On Spread- they show fine.

    When I save to Excel and open in Excel (XLS or XLSX) the text appears in 1 line on the cell. But the formula bar shows it as 2 lines.

    Doubleclicking the cell and tapping enter key, in Excel, then causes the Line Break to appear properly.

    Is this a result of Spread or a bug in Excel?

  • Posted 8 September 2017, 3:23 pm EST

    Hello,

    You need to set the CellType’s wordwrap and Multiline property to true before exporting it to excel and then it will work correctly.

    [vb]Dim g As New FarPoint.Win.Spread.CellType.TextCellType()

    g.WordWrap = True

    g.Multiline = True

    Me.fpSpread1.AllowEditOverflow = True

    Me.fpSpread1.ActiveSheet.Columns(5).CellType = g

    fpSpread1_Sheet1.Cells(5, 5).Text = “test” + Environment.NewLine + “EmptyString”[/vb]

    Hope it helps.

    Thanks,

    Reeva

  • Posted 8 September 2017, 3:23 pm EST

    interesting. will give it a shot.

  • Posted 8 September 2017, 3:23 pm EST

    Hello,

    Please take your time to check the solution and revert back at your convenience.

    Thanks,

    Reeva

  • Posted 8 September 2017, 3:23 pm EST

    worked perfect. thank you so much.

  • Posted 8 September 2017, 3:23 pm EST

    Hello,

    We are glad to know that your issue has been resolved.

    Thanks,

    Reeva

  • Posted 2 December 2017, 7:35 pm EST

    Is there a way to do the same in js? im having the same issue in wijmo 5.20173.380, in a merged cell im trying to put some break lines but after exporting to excel “the text appears in 1 line on the cell. But the formula bar shows it as 2 lines.

    Doubleclicking the cell and tapping enter key, in Excel, then causes the Line Break to appear properly.”

Need extra support?

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

Learn More

Forum Channels