none
Pivot table does not work correctly RRS feed

  • Question

  • I'm using C# Interop Excel to automate some reports.

    My first version was written before 2010 and used an old version of excel libraries. Subsequent upgrades ensured that i was working in compatibility mode - due to which i couldn't use the more latest features like slicers.

    So i upgraded to the latest. Now i find that my pivot table is not rendering correctly. I don't see the Row and column labels that i set. I'm seeing the text "Row Labels", "Column labels" but not the actual values.

    Any idea what i have to do to see actual values? 

    I'm creating the pivot table with the code below:

    PivotCache pvtCache = pvtCaches.Create(SourceType: XlPivotTableSourceType.xlDatabase, SourceData: workBook.Names.Item(srcRangeName).RefersToRange, Version: XlPivotTableVersionList.xlPivotTableVersion14);
                PivotTable pvtTable = pvtCache.CreatePivotTable(TableDestination: workBook.ActiveSheet.Range[dstRange], TableName: tableName);
                pvtTable.AddFields(RowFields: rowFields, ColumnFields: columnFields, PageFields: pageFields);


    • Edited by Arun R Kumar Wednesday, February 7, 2018 11:04 AM
    • Moved by CoolDadTx Wednesday, February 7, 2018 3:35 PM Office related
    Wednesday, February 7, 2018 11:04 AM

All replies

  • Hello Arun R Kumar,

    What's the Row and column label you set? What's your source workbook? Could you please share two screen shots to tell us the difference for the issue between before and now.

    It will be much appreciate if you could share a simply project and source excel file so we could try to use them to reproduce your issue.

    You could share files via Cloud Storage, such as One Drive, and then put link address here. Thanks for understanding.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 9, 2018 3:04 AM