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

Free Support Forum - aspose.com

How to display data PivotField in columns rather than rows?

PivotFieldType.Data fields are displayed as rows by default. How do I display them as columns instead. The documentation seems to say that PivotTable.DataField(s) (??) could be used for that and that row is the default (great, this is what I see ;-) but I'm unable to find out how to change this.

Thanks in advance.

I finally found this is done using just :

pt.AddFieldToArea(Aspose.Cells.PivotFieldType.Column, pt.DataField)

Case closed ;-)

Hi,

Thanks for your inquiry.

Could you consult the following piece of codes and create your own accordingly based on your data source.

e.g..,

pTable.AddFieldToArea(PivotFieldType.Row, 0);
pTable.AddFieldToArea(PivotFieldType.Data, 1);
pTable.AddFieldToArea(PivotFieldType.Data, 2);
//drag the data fields to column area.
pTable.AddFieldToArea(PivotFieldType.Column, pTable.DataField);

Thank you.

Hi,

Good timings! you are abs right.

Feel free to contact us anytime if you need further help.

Thank you.