I am using source data that contains values such as "10/1/2015", "11/1/2015" etc.
Understandably, when I add these values as a Column PivotFieldType:
pivotTable.AddFieldToArea(PivotFieldType.Column, MONTHYR_COLUMN);
pivotTable.ColumnHeaderCaption = "Months";
...the values in the columns correspond to those extracted from the raw data ("10/1/2015", "11/1/2015" etc.):
However, rather than that textual representation ("10/1/2015", "11/1/2015" etc.), I want the labels to be "Oct 15", "Nov 15", etc.
How can I accomplish that?
Will I have to change the data before writing it to the data sheet (from "10/1/2015" to "Oct 15", etc.) or is there a way I can interrupt the column-label-writing process on the Pivot Table?
UPDATE
It seems as if the code offered from the answer's link should work; I can loop through it, and the values are right, but nothing changes. This is my code:
// Get "10/1/2015" to display as "Oct 15"
Style columnStyle = new CellsFactory().CreateStyle();
columnStyle.Custom = "mmm yy";
CellArea columnRange = pivotTable.ColumnRange;
for (int c = columnRange.StartColumn; c < columnRange.EndColumn; c++)
{
pivotTable.Format(columnRange.StartRow + 1, c, columnStyle);
}
UPDATE 2
Even this doesn't do anything - the value of C7 is still "10/1/2015"
Cell cell = pivotTableSheet.Cells["C7"];
cell.PutValue("Oct 15");