Wrap text in Excel sheet cells

Hi all,
I using aspose cell 19.2 and export excel file has multiline content.
When I open it, these lines not break line.
But I try double click to edit (column “Description” line 14-18), it display correctly :frowning:

Here is my sample code:

        var _wb = new Workbook();
        var _ws = _wb.Worksheets[0];

        var _zStr = @"Line 1

Line 2
Line 3
Line 4";

        var _cell = _ws.Cells[0, 0];
        _cell.PutValue(_zStr);
        _ws.Cells.SetRowHeightPixel(0, 90);
        _wb.Save("d:\\test.xlsx", Aspose.Cells.SaveFormat.Xlsx);

This is my exported file:
demo.zip (9.2 KB)

@DungLT,

Thanks for sharing code. We are checking it with Aspose.Cells for .NET v19.11.

@DungLT,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47014 - Wrap text not correct

@DungLT,

Well, you need to specify style (to be applied) with wrapping text option on for the cell, see the updated code segment for your reference that works fine:
e.g
Sample code:

var _wb = new Workbook();
          var _ws = _wb.Worksheets[0];
          var _zStr = "Line 1\n\nLine 2\nLine 3\nLine 4";
    
            var _cell = _ws.Cells[0, 0];
          Style style = _cell.GetStyle();
          style.IsTextWrapped = true;
          _cell.PutValue(_zStr);
          _cell.SetStyle(style);
          _ws.Cells.SetRowHeightPixel(0, 90);
          _wb.Save("e:\\test2\\test.xlsx", Aspose.Cells.SaveFormat.Xlsx);