0

I am trying to change the row name and remove the word "Row Labels" I think that is the default. I wanted to change it to "Reviewer" Please see my codes below. I have tried to include name or different settings but still does not work.

I have included also a photo for reference.

//define the data range on the source sheet
            var dataRange = workSheetDataSource.Cells[workSheetDataSource.Dimension.Address];

            //create the pivot table
            var pivotTable = workSheetMgrAndEng.PivotTables.Add(workSheetMgrAndEng.Cells["A4"], dataRange, "PivotTable");

            //label field
            var rowField1 = pivotTable.RowFields.Add(pivotTable.Fields["Reviewer"]);
            var rowField2 = pivotTable.RowFields.Add(pivotTable.Fields["Engagement"]);

            //row field settings
            rowField1.Outline = false;
            rowField1.Compact = false;
            rowField1.ShowAll = false;
            rowField1.SubtotalTop = false;
            rowField1.Name = "Reviewer";

            rowField2.Outline = false;
            rowField2.Compact = false;
            rowField2.ShowAll = false;
            rowField2.SubtotalTop = false;

            //pivot field settings
            pivotTable.Compact = false;
            pivotTable.CompactData = false;
            pivotTable.Indent = 0;
            //pivotTable.RowGrandTotals = false;
            pivotTable.UseAutoFormatting = true;
            //pivotTable.ShowMemberPropertyTips = false;
            pivotTable.DataOnRows = false;

            //data fields
            var field1 = pivotTable.DataFields.Add(pivotTable.Fields["Engagement"]);
            field1.Name = "Count of Engagement";
            field1.Function = DataFieldFunctions.Count;

            var field2 = pivotTable.DataFields.Add(pivotTable.Fields["Prep Complete"]);
            field2.Name = "Count of Prep Complete";
            field2.Function = DataFieldFunctions.Count;

            var field3 = pivotTable.DataFields.Add(pivotTable.Fields["Sent Delivered"]);
            field3.Name = "Sent/Delivered";
            field3.Function = DataFieldFunctions.Count;

            var field4 = pivotTable.DataFields.Add(pivotTable.Fields["Return to Tax Office"]);
            field4.Name = "Count of Return to Tax Office";
            field4.Function = DataFieldFunctions.Count;

            //data fields settings
            field1.Field.Outline = false;
            field1.Field.Compact = false;
            field1.Field.ShowAll = false;
            field1.Field.SubtotalTop = false;

            field2.Field.Outline = false;
            field2.Field.Compact = false;
            field2.Field.ShowAll = false;
            field2.Field.SubtotalTop = false;

            field3.Field.Outline = false;
            field3.Field.Compact = false;
            field3.Field.ShowAll = false;
            field3.Field.SubtotalTop = false;

            field4.Field.Outline = false;
            field4.Field.Compact = false;
            field4.Field.ShowAll = false;
            field4.Field.SubtotalTop = false;

This is the current output: enter image description here

This is the output I want: enter image description here

chir
  • 21
  • 2

0 Answers0