We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pivot Blank Row and Column Delete!

Hi Team,

I have my excel data sheet is 12 rows, I am trying to get a pivot table that shows like,
one "Blank" rows , i have used below code ,

Aspose.Cells.Worksheet pivotTableSheet = obj.ExcelWorkBook.Worksheets["Pivot"];


Aspose.Cells.PivotTable pt = pivotTableSheet.PivotTables[pivotTableSheet.PivotTables.Add("Data!A6:" + obj.ExcelWorkBook.Worksheets["Data"].Cells[dt.Rows.Count+6, dt.Columns.Count -1].Name, 0, 0, "PivotTable")];



pt.ColumnFields[0].IsAutoSort = true;

pt.ColumnFields[0].IsAscendSort = true;

// pt.DisplayNullString = true;

//pt.AutoSortField = 0;

pt.ColumnFields[0].AutoSortField = -1;


pt.DataFields.AddByBaseIndex(dt.Columns["Advanced USD"].Ordinal);

pt.DataFields.AddByBaseIndex(dt.Columns["Appointment No"].Ordinal);

Aspose.Cells.PivotField datafieldnomination = pt.DataFields[1];

pt.DataFields[1].DisplayName = "Count";

pt.AddFieldToArea(PivotFieldType.Column, pt.DataField);

pt.ColumnGrand = true;

pt.AutoFormatType = Aspose.Cells.PivotTableAutoFormatType.Table2;

and I have attached Error image also .How can i remove the pivot table blank rows and columns,




I think you may try to use PivotTable.HasBlankRows to set the attribute to false, if it works for your need.

Thank you.