I can’t debug anything, it won’t compile. I have entered the complete procedure below, just copy it and paste it in a class, and you will see the errors. This is what this tread is all about. The error: “Can not apply indexing with [] to an expression of type Aspose.Cells.Pivot.PivotTable”
public void PivotTable(DataSet ds1)
{
//_excelReport.Worksheets.Add();
Worksheet sheet = _excelReport.Worksheets[0];
// Aspose.Cells.PivotTables pivotTables = sheet.PivotTables;
Aspose.Cells.Pivot.PivotTable pivotTables = sheet.PivotTables[0];
int cnt = ds1.Tables[0].Rows.Count;
int index = sheet.PivotTables.Add("=Incremental_Revenue!A1:G" + cnt, “A1”, “table”);
PivotTable pivotTable = pivotTables[index]; This is the only line that errors!
This is what the question is about, the full error is "Can not apply index with
//showing grand totals for rows.
pivotTable.RowGrand = false;
pivotTable.IsAutoFormat = true;
//Draging the first field to the row area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Row, 0);
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Row, 5);
//Draging the second field to the column area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Column, 4);
pivotTable.ColumnFields[0].IsAutoSort = true;
pivotTable.ColumnFields[0].IsAscendSort = true;
//Draging the third field to the data area.
pivotTable.AddFieldToArea(Aspose.Cells.Pivot.PivotFieldType.Data, 6);
pivotTable.DataFields[0].NumberFormat = “$#,##0”;
sheet.Cells.CreateRange(“A1”, “A1”).ColumnWidth = 25;
sheet.FreezePanes(“C3”, 20000, 12);
}