We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrap text is different in the latest version of Aspose.Cells (19.11)

Hi Team,

I noticed that, the wrap text in the excel workbook is different in the latest version of Aspose.Cells (19.11) as compared to the one in version 17.10.

Sample reproducer function

    static void TextWrapCell()
    {
        var workbook = new Workbook();
        var worksheet = workbook.Worksheets[0];
        var cell = worksheet.Cells["A1"];
        cell.PutValue("Port.\r\nBeginning\r\nMarket Value");
        var style = workbook.CreateStyle();
        var flag = new StyleFlag();

        style.IsTextWrapped = true;
        style.HorizontalAlignment = TextAlignmentType.Right;
        flag.WrapText = true;
        flag.HorizontalAlignment = true;

        var range = worksheet.Cells.CreateRange("A1:A1");
        range.ApplyStyle(style, flag);

        var options = new AutoFitterOptions { AutoFitMergedCells = true };
        worksheet.AutoFitColumns();
        worksheet.AutoFitRows(options);

        workbook.Save("TextWrapCell.xlsx");
    }

Excel File (17.10)
17_10_TextWrapCell.zip (6.3 KB)

Excel File (19.11)
19_11_TextWrapCell.zip (6.4 KB)

@dfactset,

Thanks for the sample code and sample files.

After an initial test, I am able observe the issue (difference) using latest version/fix. I found Wrap text is different in the latest version of Aspose.Cells (v19.11) when comparing with older version (Aspose.Cells for .NET v17.10). I tested the scenario/ case using both older and newer version and found the difference. I have logged an investigation ticket with an id “CELLSNET-47016” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@dfactset,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47016”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Now Aspose.Cells works as MS Excel. As the autofit result of the old version is more appropriate, we will add AutoFitterOptions.AutoFitWrappedTextType property in the next fix.

@dfactset,

Please try our latest version/fix: Aspose.Cells for .NET v19.11.2:

Aspose.Cells19.11.2 For .Net2_AuthenticodeSigned.Zip (5.0 MB)
Aspose.Cells19.11.2 For .Net4.0.Zip (5.0 MB)

Your issue should be fixed in it. See the following sample code for your reference:

var columnOptions = new AutoFitterOptions { AutoFitWrappedTextType = AutoFitWrappedTextType.Paragraph };
worksheet.AutoFitColumns(columnOptions);
var options = new AutoFitterOptions { AutoFitMergedCells = true };
worksheet.AutoFitRows(options);

Let us know your feedback

Thanks @Amjad_Sahi
The aspose update (v19.11.2) attached above fixed the issue.
Please let us know by when the release version be will be available in Nuget repos?

@dfactset,
We only publish official releases on Nuget\maven repos. The hotfix, i.e., Aspose.Cells for .NET v19.11.2 is fully tested and includes all the features (full fledged) and previous fixes and enhancements. However, if you still want the version to be uploaded onto Nuget, then you have to wait for our next official release of the product. We will publish our next official release, i.e., Aspose.Cells for .NET v19.12 (which will also include your fix) in the third week of December, 2019.

The issues you have found earlier (filed as CELLSNET-47016) have been fixed in Aspose.Cells for .NET v19.12. This message was posted using Bugs notification tool by Amjad_Sahi