Hi,
Thanks for providing further details and screen shot.
After further evaluation and using a valid license to run your project, I observed the issue as you mentioned. The error “Cannot edit a PivotTable in group edit mode” is prompted by MS Excel in the output Excel file generated by Aspose.Cells APIs in the License mode, it works fine in evaluation mode (without setting the valid license) though.
e.g
Sample code:
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(“E:\Licenses\Aspose.Cells.lic”);
// licenseCellHW.SetLicense(path);
var workbook = new Workbook();
//Obtaining the reference of the first worksheet
var sheet = workbook.Worksheets[0];
//Name the sheet
sheet.Name = “data”;
var cells = sheet.Cells;
int urange = 1;
cells[“A” + urange].PutValue(“State”);
cells[“B” + urange].PutValue(“City”);
cells[“C” + urange].PutValue(“Population”);
urange++;
cells[“A” + urange].PutValue(“TN”);
cells[“B” + urange].PutValue(“Chennai”);
cells[“C” + urange].PutValue(“50”);
urange++;
cells[“A” + urange].PutValue(“KL”);
cells[“B” + urange].PutValue(“Cochin”);
cells[“C” + urange].PutValue(“70”);
urange++;
cells[“A” + urange].PutValue(“KA”);
cells[“B” + urange].PutValue(“Bangalore”);
cells[“C” + urange].PutValue(“80”);
urange++;
cells[“A” + urange].PutValue(“AP”);
cells[“B” + urange].PutValue(“Hydrapad”);
cells[“C” + urange].PutValue(“63”);
var listObject = sheet.ListObjects[sheet.ListObjects.Add(“A1”, “C5”, true)];
//To fit the column as per test size.
sheet.AutoFitColumns(0, 26);
//Adding Default Style to the table
listObject.TableStyleType = ExcelTableStyle;
var sheet2 = workbook.Worksheets[workbook.Worksheets.Add()];
//Naming the sheet
sheet2.Name = “PivotSheet”;
//Getting the pivottables collection in the sheet
var pivotTables = sheet2.PivotTables;
//Adding a PivotTable to the worksheet
var index = pivotTables.Add("=" + sheet.Name + “!A1:C5”, “A1”, sheet2.Name);
//To fit the column as per test size.
sheet2.AutoFitColumns(0, 24);
//Accessing the instance of the newly added PivotTable
PivotTable pivotTable = pivotTables[index];
//Showing the grand totals
pivotTable.RowGrand = false;
pivotTable.ColumnGrand = false;
pivotTable.IsAutoFormat = true;
pivotTable.RowHeaderCaption = “State”;
pivotTable.AutoFormatType = PivotTableAutoFormatType.None;
pivotTable.PageFieldOrder = PrintOrderType.DownThenOver;
pivotTable.PivotTableStyleType = ExcelPivotTableStyle;
pivotTable.AddFieldToArea(PivotFieldType.Row, “State”);
pivotTable.AddFieldToArea(PivotFieldType.Row, “City”);
pivotTable.AddFieldToArea(PivotFieldType.Data, “Population”);
var pivotFields = pivotTable.RowFields;
//Hide the subtotal.
for (var i = 0; i < pivotFields.Count; i++)
{
pivotTable.RowFields[i].SetSubtotals(PivotFieldSubtotalType.None, true);
}
sheet2.MoveTo(0);//Move PivotTable Sheets to 0th Position in the workbook
workbook.Save(“e:\test2\pivottest1.xlsx”, SaveFormat.Xlsx);
I have logged a ticket with an id “CELLSNET-43070” for your issue. We will look into it soon.
Once we have any update on it, we will let you know here.
Thank you.