After 23.6 version migration adding data to excel table is not filtering

We have been using following method to add a pre-defined worksheet of an excel with dynamic custom Data.

Previously, all the data getting added to the sheet was part of the table. Hence we were able to filter data from header.

Once we upgraded Aspose.Cells to version 23.6 we changed the HtmlLoadOptions to LoadOptions(LoadFormat.Xlsx)

Now with the same existing code, it adds data to the worksheet but filtering functionality is not working for the data.

image.png (4.5 KB)

It would be helpful if you provide us the resolution to this newly introduced problem.

Thanks !

@mrudang
Would you like to provide your sample file and test code? We will check it soon.

Only able to upload image - this is the input sheet with table already created.

image.png (6.0 KB)

Code for adding data to the table.

var isCustomReport = !string.IsNullOrEmpty(reportType) && reportType.Contains(“custom”);
string outputFile = Path.Combine(StringFunctions.GetApplicationTempFolderPath(), Guid.NewGuid().ToString());
var loadOptions = new LoadOptions(LoadFormat.Xlsx);
//Create a Workbook object and opening the file from its path
var workbook = new Workbook(convertDocumentInfo.InputFileName, loadOptions);

                if (listOfObject != null && listOfObject.Count > 0)
                {
                    foreach (int sheetNumber in listOfObject.Keys)
                    {
                        CustomObjects customObjects = listOfObject[sheetNumber];
                        if (customObjects != null && customObjects.List != null && customObjects.List.Count > 0)
                                workbook.Worksheets[sheetNumber].Cells.ImportCustomObjects((ICollection)customObjects.List, customObjects.PropertyName, true, customObjects.FirstRow, customObjects.FirstColumn, customObjects.List.Count, true, "", false);                              }
                    }
                }

@mrudang
Please compress the sample files and data files into zip format and upload them here. Would like to provide runnable test code? it will be very helpful for us to locate the issue. We will check it soon.

@mrudang
By creating sample files and testing the following sample code on the latest version v24.9, we can reproduce the issue. After adding data to the table, it was found that the table cannot filter the added data. Please refer to the attachment. result.zip (14.5 KB)

The sample code as follows:

LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);
//Create a Workbook object and opening the file from its path
Workbook workbook = new Workbook(filePath + "a.xlsx", loadOptions);

// Define List
List<Item> list = new List<Item>();

// Add data to the list of objects
list.Add(new Item() { Id = "id1", Naam = "test1" });
list.Add(new Item() { Id = "id2", Naam = "test2" });
list.Add(new Item() { Id = "id3", Naam = "test3" });

workbook.Worksheets[0].Cells.ImportCustomObjects(list, new string[] { "Id", "Naam"}, true, 1, 0, 3, true, "", false);

workbook.Save(filePath + "out.xlsx");

public class Item
{
    public string Id { get; set; }
    public string Naam { get; set; }
}

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-56900

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Do you know on which version this issue has been introduced ?
So that we can degrade to the last working version by that time.

@mrudang,

Please spare us little time so we could evaluate your issue thoroughly before we could update you on it.

@mrudang
Could you share a sample project with John’s sample codes? We do not confirm which row you want to insert after. And do you want to replace header row with fields’ name?

@simon.zhao
We used to get the final output as shown in the image below. With version 23.6 it is breaking.

And
isPropertyNameShown = false

image.png (2.9 KB)

@mrudang
Thank you for your feedback and detailed information provided. We can still reproduce your issue after setting isPeopleNameShown to false. Once there is an update, we will notify you promptly.

@mrudang
Please add two empty data row in the table as the attached file:
a.zip (7.3 KB)
These data could be inserted fine.

We are still working on how to insert data with one empty row.

@mrudang
Please try the latest version 24.10.

1 Like

Hi @simon.zhao

I upgraded Aspose.cells to 24.10
It is now throwing error with rest of my existing code for method ImportDataTable in cells class

workbook.Worksheets[0].Cells.ImportDataTable(convertDocumentInfo.TableData, true, “A1”);

@mrudang
Would you like to provide your sample file and test code? Please compress the data files and sample files into zip format and upload them here, and we will check them soon.

Hi @simon.zhao

I upgraded Aspose.cells to 24.10
This version is missing a method from

namespace Aspose.Cells
public class Cells
and the name of the method is “ImportDataTable”

We used to use it as follows
workbook.Worksheets[0].Cells.ImportDataTable(convertDocumentInfo.TableData, true, “A1”);

with version 24.10 of Aspose.cells library it says,

image.png (27.4 KB)

This used to work in 23.6 version. Do you have any alternate of this deprecated method. ?

@mrudang
Please use Cells.ImportData(DataTable, int, int, ImportTableOptions) instead of Cells.ImportDataTable(DataTable, bool, string).

For more alternative methods of importing data, please refer to the following document.