Incorrect source value of data model connection and pivot table

We have the following test file: DataModelConnection.xlsx.zip (26.9 KB)

This spreadsheet contains one pivot table, with the data source added to data model. Therefore, this file also contains one data model connection. Now we have the following test code:

var workbook = new Workbook("DataModelConnection.xlsx");

var dataModelConnection = workbook.DataConnections.OfType<DataModelConnection>().First();
var command = dataModelConnection.Command; // expected: Sheet1!$A$1:$B$10, actual: 1

var pivotTable = workbook.Worksheets[0].PivotTables[0];
var dataSource = pivotTable.DataSource; // null
var dataModelSource = pivotTable.GetSourceDataConnections()[0].Command; // expected: Sheet1!$A$1:$B$10, actual: 1

The value of dataModelConnection.Command returned by Aspose.Cells is incorrect. In Excel, if you go to Data > Queries & Connections > tab Connections > right click WorksheetConnection_1 > Properties > tab Definition, you see the correct value under “Command text”.

The value of pivotTable.DataSource or pivotTable.GetSourceDataConnections()[0].Command returned by Aspose.Cells is also incorrect. In Excel, if you go to PivotTable Analyze > Change Data Source, you see the correct value in the “Table/Range” field.

We’re using Aspose.Cells 24.10.0 for .NET.

Hint: we found in the XML that the correct value can be found in a hidden defined name: image.png (2.5 KB)

@perfectxl,

Thanks for the template Excel file and details.

After initial testing, I am able to reproduce the issue as you mentioned by using your template Excel file. I found incorrect source value of data model connection and pivot table.

We require thorough evaluation of the issue. 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-56969

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.

@perfectxl,

We are pleased to inform you that your issue (Ticket ID: “CELLSNET-56969”) has been resolved. The fix/enhancement will be included in the next (upcoming) release (Aspose.Cells v24.11 package) that we plan to release in the first half of November 2024. You will be notified when new version is published.

The issues you have found earlier (filed as CELLSNET-56969) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi