We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Data field Display Name Rotation

Dear Aspose support team,

I have the requirement like to display the data field caption with 90 degree rotation.

I have used the following code to display the data field caption. But i am not able to achieve the caption with 90 degreee rotaion.
pivotTable.DataFields[1].DisplayName = "All fast";

I have enclosed the 3 screenshots(1.what i expected 2.Actual 3.Properties) for your kind reference.

Could you please help me how to achieve this feature and provide the sample piece of code.

Awaiting for your earliest reply.

Regards,

Saravanan

Hi,


The feature is not available for the pivot table report data, although you may rotate normal cells data. I have logged a ticket for your feature request with an id: CELLSNET-40072. We will look into it if we can support it.

Thank you.

Hi,

Please try this sample code to set the cell style in the pivot table :

Style style = wb.CreateStyle();
style.Rotation = 90;
wb.Worksheets[0].PivotTables[0].Format(row, col, style);

thanks.

Hi,

Above code working fine for the cells(not from the data field caption) but I have the requirement like to display the data field caption with 90 degree rotation.

I have used the following code to display the data field caption. But i am not able to achieve the caption with 90 degreee rotaion. pivotTable.DataFields[0].DisplayName = "All Fast ";

I need to display the "All Fast" caption with 90 degree rotation.


Awaiting for your response.

Thanks in advance.

Regards,

Saravanan

Hi,


Could you give us sample code segment (for which field caption you are apply the rotation style) in the pivot table with template file, we will look into it and log it if it is bug or evaluate if this is possible to accomplish.

Thank you.

Hi Support team,

Please find the below sample code which i have used and the sample template for your kind reference.
In the sample template, cell "F8" (Caption of Data field) need to be rotate 90 degree.

Style DataStyle = obj.ExcelWorkBook.CreateStyle();

DataStyle.Font.Size = 8;
DataStyle.Font.Name = "Arial";
DataStyle.Font.Color = Color.Black;
DataStyle.RotationAngle = 90;

pivotTable.AutoFormatType = PivotTableAutoFormatType.Classic;

pivotTable.DataFields[0].DisplayName = "All Fast ";

obj.ExcelWorkBook.Worksheets[0].PivotTables[0].Format(7, 5, DataStyle);

Please advice me, if i not used the code correctly

Thank you
Saravanan

Hi,

Please try the latest version/fix: Aspose.Cells for .NET v7.0.2.7

I have tested with it and it works fine with your file.

I used the following sample code and find attached the output file.

Sample code:

Workbook ExcelWorkBook = new Workbook("e:\\test2\\templatek.xlsx");

Style DataStyle = ExcelWorkBook.CreateStyle();

DataStyle.Font.Size = 8;
DataStyle.Font.Name = "Arial";
DataStyle.Font.Color = Color.Black;
DataStyle.RotationAngle = 90;

PivotTable pivotTable = ExcelWorkBook.Worksheets[0].PivotTables[0];

pivotTable.AutoFormatType = PivotTableAutoFormatType.Classic;

pivotTable.DataFields[0].DisplayName = "AllM Fast ";

ExcelWorkBook.Worksheets[0].PivotTables[0].Format(7, 5, DataStyle);

ExcelWorkBook.Save("e:\\test2\\outtemplatek.xlsx");


Thank you.

Hi Support team,

Please find the attached screenshots for your kind reference. After the editing in the sample sheet it is going to the old stage.

Still i am not able to rotate the caption of the data field.

In addition, i am getting error while setting the style property in the Range class(version 7.0.2.7).
eg: workbook.Worksheets[sheetIndex].Cells.CreateRange(startingRow, startingColumn, rowCount, columnCount).Style = style2;

Thank you
Saravanan

Hi,


It works fine here even after clicking “Enable Editing” in MS Excel 2010. It also works fine in MS Excel 2007.

And, you cannot use Range.ApplyStyle() method for a pivot table cells. You have to use PivotTable.Format API.

Thank you.