X-axis labels orientation in word document chart

X-axis labels orientation in word document. please help on this. Now it is showing based on data, but I want vertical.

please help with code snippet.

@Amol_Hekade I am afraid there is no way to set axis labels rotation and orientation at the moment.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27202,WORDSNET-27203

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@alexey.noskov I want to upgrade our license, if i am not sure then how can I tell management to upgrade, so please help to fix asap. So I can go for upgrade.

@Amol_Hekade Unfortunately, we cannot provide you any workaround for setting axis labels rotation. The issues are currently in the queue for analysis so no estimates are available. Please accept our apologies for your inconvenience.

The issues you have found earlier (filed as WORDSNET-27203,WORDSNET-27202) have been fixed in this Aspose.Words for .NET 24.8 update also available on NuGet.

Hi,

Please provide sample code for this. Which parameters to be set for orientation.

Please share sample code for xAxis label orientation.

@Amol_Hekade The new properties Orientation and Rotation have been added to the AxisTickLabels class:

/// <summary>
/// Gets or sets the orientation of the tick label text.
/// </summary>
/// <remarks>
/// The default value is ShapeTextOrientation.Horizontal.
/// Note that some ShapeTextOrientation values do not affect the orientation of tick label text in value axes.
/// </remarks>
public ShapeTextOrientation Orientation { get; set; }

/// <summary>
/// Gets or sets the rotation of the tick labels in degrees.
/// </summary>
/// <remarks>
/// The range of acceptable values is from -180 to 180 inclusive. The default value is 0.
/// </remarks>
public int Rotation { get; set; }

UC to set orientation and rotation of axis tick labels

// Create a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a column chart.
Shape shape = builder.InsertChart(ChartType.Column, 432, 252);
AxisTickLabels xTickLabels = shape.Chart.AxisX.TickLabels;
AxisTickLabels yTickLabels = shape.Chart.AxisY.TickLabels;

// Set axis tick label orientation and rotation.
xTickLabels.Orientation = ShapeTextOrientation.VerticalFarEast;
xTickLabels.Rotation = -30;
yTickLabels.Orientation = ShapeTextOrientation.Horizontal;
yTickLabels.Rotation = 45;

// Save the document.
doc.Save(dir + "AxisTickLabelOrientation.docx");

@alexey.noskov thanks for prompt reply.

1 Like