how to set Number format to pivot table datafields

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

how to set Number format to pivot table datafields

Postby chaitanya » Wed May 29, 2013 7:25 am

could you please let me know how to set number format to pivot table datafields
chaitanya
 
Posts: 12
Joined: Thu May 16, 2013 10:42 am

Re: how to set Number format to pivot table datafields

Postby amy.zhao » Wed May 29, 2013 9:03 am

Dear chaitanya,

Thanks for your inquiry.
Please refer to the code snippet below.
Code: Select all
            PivotField fieldOrderNo = pivotTable.PivotFields["OrderNo"] as PivotField;
            fieldOrderNo.Axis = AxisTypes.Row;
            fieldOrderNo.NumberFormat = "0.00";


Regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2273
Joined: Wed Jun 27, 2012 8:50 am

Re: how to set Number format to pivot table datafields

Postby amy.zhao » Tue Jun 04, 2013 9:08 am

Dear chaitanya,

Has this issue been resolved?
Please give us a feedback at your early convenience.

Thanks & Regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2273
Joined: Wed Jun 27, 2012 8:50 am

Re: how to set Number format to pivot table datafields

Postby chaitanya » Tue Jun 04, 2013 9:46 am

Dear Amy,

thanks for your continuous support.

the code below you provided works perfectly.

but is there a possibility to set number format like pivottable.datafields[0].numberformat because I don't want to set the format immediately after creating rather I do like to set the format after all the datafields are created.
chaitanya
 
Posts: 12
Joined: Thu May 16, 2013 10:42 am

Re: how to set Number format to pivot table datafields

Postby amy.zhao » Wed Jun 05, 2013 6:27 am

Dear chaitanya,

Thanks for your feedback.
For your new issue below:
"is there a possibility to set number format like pivottable.datafields[0].numberformat?"
Yes, you could try the code below.
Code: Select all
PivotTable pivottable=sheet2.PivotTables[0];
pivottable.PivotFields[0].NumberFormat = "0.0";
pivottable.PivotFields[1].NumberFormat = "0.00";


Regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2273
Joined: Wed Jun 27, 2012 8:50 am

Re: how to set Number format to pivot table datafields

Postby Gary.zhang » Fri Jun 07, 2013 9:01 am

Hello chaitanya,

Has the code provided by worked fine for you? Has the issue been resolved? Could you please update the thread if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar
Gary.zhang
 
Posts: 1390
Joined: Thu Apr 04, 2013 1:30 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 1 guest