Hi Willem-Jan,
Hi,
Please download and try our latest version/fix: Aspose.Cells for .NET v7.7.0.2
We have fixed this issue.
· There are some
points for attention though:
-
PageFields attribute of PivotTable specifies a collection of PivotField in page or filter label area. RowFields attribute of PivotTable specifies a collection of PivotField in row label area. ColumnFields attribute of PivotTable specifies a collection of PivotField in column label area. DataFields attribute of PivotTable specifies a collection of PivotField in data label area. DataField attribute of PivotTable exists only if DataFields contains two or more PivotField.
-
DataField is a virtual PivotField, which can be placed in Column label area or Row label area.
-
If you want to remove a PivotField, you have the following three ways:
First, using the method RemoveField(PivotFieldType fieldType, string fieldName).
Second, using the method RemoveField(PivotFieldType fieldType, int baseFieldIndex).
Third, using the method RemoveField(PivotFieldType fieldType, PivotField pivotField).
But if you use the method RemoveField(PivotFieldType fieldType, PivotField pivotField), there are some points to be noted. If the second parameter pivotField is DataField attribute of PivotTable, you will remove all the PivotField in DataFields. If you do it like this in MS Excel, you will get the same result. So the code in sample project should be as follows:
if (pivotTable.DataField != null)
{
pivotTable.RemoveField(PivotFieldType.Data, pivotTable.DataField);
}
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
As a result of the count of DataFields is one, so DataField attribute of PivotTable is null, if block will not be executed. So, when you add a PivotField existed in DataFields to Data label area, it is added twice.
- For the problem, “There’s already data in […]Sheet1. Do you want to replace it?”
Please change the codes accordingly:
e.g.
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
pivotTable.AddFieldToArea(PivotFieldType.Data, "Menge");
to:
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
pivotTable.AddFieldToArea(PivotFieldType.Data, "Menge");
pivotTable.RefreshDataFlag = true;
as a result of the default position of DataField is in row label area, so if you want to get the same result like source file, you should use the codes as follows:
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
pivotTable.AddFieldToArea(PivotFieldType.Data, "Menge");
pivotTable.AddFieldToArea(PivotFieldType.Column, pivotTable.DataField);// add DataField to column label area
pivotTable.RefreshDataFlag = true;
Hope, this helps a bit.
Thank you.
Hi,
Hi Willem-Jan,
Hi,
sheet.Cells.ClearRange(pivotTable.ColumnRange);
sheet.Cells.ClearRange(pivotTable.DataBodyRange);
Hi,
Hi Willem-Jan,
Hi,
pivotTable.RefreshData();
pivotTable.CalculateData();
Hi,
Hi Willem-Jan,
Hi,
Hi Willem-Jan,
Hi,
Please download and try our latest fix/version: Aspose.Cells for Java v7.7.0.4
Please change the sample
codes as follows:
e.g.
sheet.Cells.ClearRange(pivotTable.RowRange);
sheet.Cells.ClearRange(pivotTable.ColumnRange);
sheet.Cells.ClearRange(pivotTable.DataBodyRange);
if (pivotTable.DataField != null)
{
pivotTable.RemoveField(PivotFieldType.Data, pivotTable.DataField);
}
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
to:
pivotTable.ClearData();
pivotTable.DataFields.Clear();
pivotTable.AddFieldToArea(PivotFieldType.Data, "Betrag Netto FW");
Thanks that is really fast, the only problem is i don’t use java i need .net dll’s.
Hi,
Thanks! It works
Hi,
The issues you have found earlier (filed as CELLSNET-42149) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi,
Thanks for using Aspose.Cells.
Please download and try this fix: Aspose.Cells
for .NET v8.0.1.1 for your issue CELLSNET-42269 and let us know your feedback.
The issues you have found earlier (filed as CELLSNET-42269) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.