Data sorter obliterates rich test formatting

I am using Aspose to create a spreadsheet in which the fields are formatted with Rich Text Formatting (that is, in many cells, only part of the value is in bold or italics).

After I fill in the data I sort the worksheet with the DataSorter object.

However, to my horror, I’ve found that the Sort wipes out all of my character-level Rich Text Formatting. Specifically: if a cell is completely bold, the bold state is maintained after the sort. However, if a cell is only partially bold, then the DataSorter eliminates the bold altogether.

Please advise!

-------------------------------

For reference, here is the code I’m using to do the sort:

DataSorter sorter = workbook.DataSorter;

sorter.Order1 = Aspose.Cells.SortOrder.Descending;

sorter.Key1 = 2;

CellArea ca = new CellArea();
ca.StartRow = 1;
ca.StartColumn = 0;
ca.EndRow = lastrow;
ca.EndColumn = 5;

// Do the sort!
sorter.Sort(wbkWorkSheet.Cells, ca);

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to replicate this issue using the following code with the latest version. The rich text formatting is lost when data sorter is used on second column of the source workbook. We have logged this issue in our database. We will look into it and resolve this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42040.

We have also attached the source and output files for a reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


//Get the workbook datasorter object.

DataSorter sorter = workbook.DataSorter;


//Set the first order for datasorter object.

sorter.Order1 = Aspose.Cells.SortOrder.Descending;


//Define the first key.

sorter.Key1 = 0;


//Set the second order for datasorter object.

sorter.Order2 = Aspose.Cells.SortOrder.Ascending;


//Define the second key.

sorter.Key2 = 1;


//Create a cells area (range).

CellArea ca = new CellArea();


//Specify the start row index.

ca.StartRow = 0;


//Specify the start column index.

ca.StartColumn = 0;


//Specify the last row index.

ca.EndRow = 13;


//Specify the last column index.

ca.EndColumn = 1;


//Sort data in the specified data range (A1:B14)

sorter.Sort(workbook.Worksheets[0].Cells, ca);


//Save the excel file.

workbook.Save(filePath + “.out.xlsx”, SaveFormat.Xlsx);



Hi,


Please try the attached latest version/fix: Aspose.Cells for .NET v7.5.3.5, we have fixed your issue now.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSNET-42040) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.