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

Free Support Forum - aspose.com

How to make the rotation angle of category axis automatic

Hi,

In Ms Excel, when creating a chart, the default axis rotation angle is automatically adjusted to avoid text overlapping:
image.png (84.4 KB)

However in Aspose.Cells, this value was considered as ‘0’ and when re-setting this value on an axis, the rotation angle is not automatic anymore and the labels are sometimes overlapped:

var workbook = new Workbook(@“MsChart.xlsx”);
var chart = workbook.Worksheets[0].Charts[0];
chart.CategoryAxis.TickLabels.RotationAngle = chart.CategoryAxis.TickLabels.RotationAngle; // just assign the original value
workbook.Save(@“out.xlsx”);

image.png (12.7 KB)

I’ve attached the test files for your reference. Could you please let me know if there’s a way to make rotation of the axis label automatic just like what it looks like in Ms Excel?

test files.zip (21.4 KB)

Thanks,

@ServerSide527,

Thanks for your query.

I have opened the source file “MsChart.xlsx” in Excel 2016 and opened the Format Axis property tab. If you once enter the field “Custom Angle”, then it is must required to set some angle which is 0 by default. Excel does not allow to leave this field without entering some angle. Same behavior is shown by Aspose.Cells, where if you set this value, then it is considered and followed by the rendering engine. If you do not set this value and save the file, the rotation angle is fine and no issue is observed.

Please test this behavior using Excel and provide your feedback.

Hi,

Thanks for your reply.

I understand in Excel this is a ‘one-off’ setting and once the value is manually set it will not be possible to set it back. But in Ms Excel it does have the ability to create a chart from scratch like this. Is it something that we can also do in Aspose? (create a chart and make the rotation angle as empty)

Thanks

@ServerSide527,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46286 - Issue while setting rotation angle of category axis

@ServerSide527,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@ServerSide527,

Please give a try to our latest fix Aspose.Cells for .NET 18.8.1 which should resolve your issue. We have provided CategoryAxis.TickLabels.IsAutomaticRotation for angle to automatic.

The issues you have found earlier (filed as CELLSNET-46286) have been fixed in Aspose.Cells for .NET v18.9. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi