Aspose.Cells for .NET在使用Aspose.Cells.Pivot.PivotTable 的AddFieldToArea(PivotFieldType fieldType, string fieldName)時,新增PivotFieldType.Row的資料進去,會出現"This pivot field has more unique items than can be used in a pivot table."的例外錯誤。
Could you please provide a sample (console) application/program (complete source code without compilation errors) along with a sample Excel file (if any) to reproduce the issue on our end? We will check your issue soon.
Please zip the resource files before attaching them.
@ScarSu
By creating a sample file and testing it on the latest version v24.9 using the following sample code, we can reproduce the issue. Discovered CellsException: This pivot field has more unique items than can be used in a pivot table. Excel can add pivot tables normally, please refer to the attachment. result.png (48.7 KB)
// Load the workbook
Workbook workbook = new Workbook(filePath + "sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
// Add a Pivot Table
int pivotTableIndex = worksheet.PivotTables.Add("=A1:C133823", "J1", "PivotTable1");
PivotTable pivotTable = worksheet.PivotTables[pivotTableIndex];
// Set the row fields
pivotTable.AddFieldToArea(PivotFieldType.Row, 0);
pivotTable.AddFieldToArea(PivotFieldType.Row, 1);
// Set the data field
pivotTable.AddFieldToArea(PivotFieldType.Data, 2);
// Save the workbook with the Pivot Table
workbook.Save(filePath + "out_net.xlsx");
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-56899
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.
We are pleased to inform you that your issue (Ticket ID: “CELLSNET-56899”) has been resolved. The fix/enhancement will be included in our upcoming release (Aspose.Cells v24.10) that we plan to release in this week. You will be notified when the next version is released.
Please note, we have added method: public int Add(string sourceData, string cell, string tableName, bool useSameSource, bool isXlsClassic) of PivotTableCollection that you may use with the new release to sort out your issue.
The issues you have found earlier (filed as CELLSNET-56899) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi