locked
Getting custom style from existing excel pivotTable RRS feed

  • Question

  • Hi, 

    I am developping an excel addin for excel 2010 and excel 2013 using c#.

    1) I insert a pivottable in excel with my addin.

    2) I customize manually the style of the pivot table.

    3) I modify my pivottable by adding new rows and columns.

    I need to add a c# code to the function which modify the pivottable in order to get my custom style and aplly it to the new pivottable.

    My question:

    Is there a way ito do this in c#?

    Friday, June 20, 2014 5:03 PM

Answers

  • >>I modify my pivottable by adding new rows and columns.<<

    How did you add new rows and columns to pivot table?

    Share your code here.

    If you customize manually the style of the pivot table, no matter what you changed, the style will effect every element in this pivot table.

    Moreover, you can record a macro to get VBA code if you can do manually. It is easy to convert VBA code to C# since they are using the same Object Model.
    • Edited by Andy_mic Monday, June 23, 2014 3:40 AM
    • Marked as answer by George Hua Friday, June 27, 2014 9:43 AM
    Monday, June 23, 2014 3:37 AM

All replies

  • >>I modify my pivottable by adding new rows and columns.<<

    How did you add new rows and columns to pivot table?

    Share your code here.

    If you customize manually the style of the pivot table, no matter what you changed, the style will effect every element in this pivot table.

    Moreover, you can record a macro to get VBA code if you can do manually. It is easy to convert VBA code to C# since they are using the same Object Model.
    • Edited by Andy_mic Monday, June 23, 2014 3:40 AM
    • Marked as answer by George Hua Friday, June 27, 2014 9:43 AM
    Monday, June 23, 2014 3:37 AM
  • hi,

    this page might be helpful - how to update an existing pivot table data source using C# 

    ________________________________________

    FREE C# Word  component is being evaluated, any recommendation is appreciated.

    Thanks and Regards

    Life is made up of little things.~)


    • Edited by leo_456 Tuesday, June 24, 2014 7:28 AM
    Tuesday, June 24, 2014 7:27 AM