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

Free Support Forum - aspose.com

PivotTable Sum Columns bla

Hi,


We have aspose setup creating loads of spread sheets and its all fine apart from the Sun fields for pivot tables. When the document is created, they appear without titles and the data on the page treats them like dodgy values.

Dropping them off and adding them in excel corrects the issue but Im not sure how or why they are doing this.

http://screencast.com/t/tw0qAFdXLFB

//Add Fields
foreach (ExcelPivotTableField field in this.Fields.OrderBy(f => f.Order))
{
var column = visibleColumns.FirstOrDefault(c => c.ColumnName == field.ColumnName);
int fieldIndex = visibleColumns.IndexOf(column);

// if this column doesn’t actually exist, skip adding it to the pivot table
if (fieldIndex == -1)
continue;

int holdField = pivotTable.AddFieldToArea(field.FieldType, fieldIndex);
PivotFieldCollection holdFields = pivotTable.Fields(field.FieldType);
var fieldInPivot = holdFields[holdField];
fieldInPivot.DisplayName = field.ColumnAlias;

if (field.FieldType == PivotFieldType.Data)
{
fieldInPivot.Function = field.AggregationType;
fieldInPivot.DisplayName = field.ColumnAlias;
}

I have tried settings the DisplayName and that does give it a value on screen but changes nothing about how the pivot table doesn’t seem to recognize it.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v8.2.1.x if you are not already using it, we incorporated more enhancements and fixes regarding PivotTables in the new versions.
If you still find the issue, kindly provide us your sample console application (runnable) to reproduce the issue on our end with v8.2.1.x. Also, provide your actual and expected Excel file with your input template file (if you have any), it will also help us to evaluate your issue more precisely to figure it out soon. You can provide expected output file by editing or creating the file into MS Excel manually to display your desired Pivot table, we will check your issue soon.

Thank you.