Applying a style to a range of cells in a pivot table

I am having problems setting a style to a range of cells (entire column minus header and footer).

The only way I can get it to work is to loop the cells and apply them directly, and this is verry slow, it makes it take about an hour to generate from a minute without it (large workbook with a lot of tabs)

//doesn’t work on pivot table
Range fundrange = tmpws.Cells.CreateRange(FundCell.Name, FundCell.Name.Substring(0, 1) + LastCell.Row);
StyleFlag flg = new StyleFlag();
fundrange.ApplyStyle(GreenColumn, flg);
// tmpws.Cells.Columns[FundCell.Column].ApplyStyle(GreenColumn, flg);


//super slow
for (int i = FirstCell.Row + 1; i < LastCell.Row; i++)
{
table.Format(i, FundCell.Column, GreenColumn);
}


So is there some trick to applying styles to a pivot table?

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Well, if there are more tables, it will surely take more time. Please try the following code before applying formatting and see if it works fine for you.

C#


pivotTable.RefreshData();

pivotTable.CalculateData();