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

Free Support Forum - aspose.com

How to change the GapWidth in a BarStacked chart in Aspose.Words .NET


I’m creating a BarStacked Chart in Aspose.Words for .NET and I’d like to modify the GapWidth property of the series.

I’ve found something similar in the Java documentation for Aspose.Slides, but I cannot find the .NET equivalent for the following Java code (even in the .NET documentation for Aspose.Slides):

series = chart.getChartData().getSeries().get_Item(1);

I tried the following code, but no success:

var shape = _builder.InsertChart(ChartType.BarStacked, w, h);
var chart = shape.Chart;
var series = seriesColl.Add("series 1", categories, new double[] { 1, 2 });
//series.ParentSeriesGroup   // <--- does not exists

So, how can I set the GapWidth property in .NET from Aspose.Words?



Thanks for your inquiry. To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Your expected DOCX Word document showing the correct output. You can create expected document by using MS Word.
  • Please also provide a comparison screenshot highlighting the difference between input and expected documents

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.


Here are the two documents: gapwidth.zip (16.6 KB)

And here is a sample code:

var doc = new Document();
var builder = new DocumentBuilder(doc);
var shape = builder.InsertChart(ChartType.BarStacked, 500, 500);
var chart = shape.Chart;

var seriesColl = chart.Series;

var categories = new[] {"Category 1", "Category 2"};
seriesColl.Add("Series 1", categories, new double[] {1, 2});
seriesColl.Add("Series 2", categories, new double[] {3, 4});


You’ll see that the GapWidth (i.e. space between the bars) is different in the “wanted” docx.



We are working on your query and will get back to you soon.


We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17602. We will further look into the details of this requirement and will keep you updated on the status of the linked issue.

1 Like