Articles in this section
Category / Section

How to set the X-axis label position of the chart in the ASP.NET Core Word document?

4 mins read

Syncfusion DocIO is a  ASP.NET Core DocIO  used to create, read, and edit Word documents programmatically without Microsoft Word or interop dependencies. Using this library, you can set the X-axis label position of the chart in the Word document.

Steps to set the X-axis label position of the chart in the Word document:

  1. Create a new C# console application project.
    Create .NET Core console application in Visual Studio in ASP.NET Core Word
  2. Install  the Syncfusion.DocIO.Net.Core NuGet package as a reference to your .NET applications from NuGet.org.
    Add DocIO.Net.Core NuGet packages of ASP.NET Core Word
  3. Include the following namespace in the Program.cs file.
    C#
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.OfficeChart;
  1. Use the following code example to set the X-axis label position of the chart in the Word document.
    C#
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"../../../Data/Input.docx"), FileMode.Open))
{
   //Load an existing Word document.
   using (WordDocument wordDocument = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Automatic))
   {
             // Get the paragraph.
             WParagraph paragraph = wordDocument.LastParagraph;
             //Get the chart entity.
             WChart chart = paragraph.ChildEntities[0] as WChart;
             //Set X-axis label position to the bottom of the chart.
             chart.PrimaryCategoryAxis.TickLabelPosition = OfficeTickLabelPosition.TickLabelPosition_Low;
             //Create a file stream.
             using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
             {
                   //Save the Word document to the file stream.
                   wordDocument.Save(outputFileStream, FormatType.Docx);
             }
    }
}

A complete working sample to set the X-axis label position of the chart in the Word document using C# can be downloaded from GitHub.

By executing the program, you will get the Word document as follows.

Output document generated in ASP.NET Core Word~~~~

Take a moment to peruse the documentation, where you can find basic Word document processing options along with the features like mail mergemerge, and compare documentsfind and replace text in the Word document, protect the Word documents, and most importantly, the PDF and Image conversions with code examples.

Explore more about the rich set of Syncfusion Word Framework features.

See Also
  1. How to set Date format in X axis of chart in Word document
  2. How to change scatter chart marker color for each data points in Word document
  3. How to create line chart in Word document using C# and VB.NET
  4. How to create clustered column chart in Word document using C# and VB.NET
  5. How to create bubble chart in Word document using C# and VB.NET
  6. How to create line chart with different color series in Word document using C#?
  7. How to set column space for column charts in Word document?
  8. How to set Y-axis interval for column charts in Word document?
  9. How to change chart title position in the Word document?

Conclusion
I hope you enjoyed learning about how to set the X-axis label position of the chart in the ASP.NET Core Word document.

You can refer to our ASP.NET Core DocIO feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET Core DocIO example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied