Free Support Forum -

How to remove "Secondary (Vertical) Value Axis Major Gridlines"?


I am using Aspose.Slide and create chart. I would like to remove vertical gridlines from second axis (Secondary (Vertical) Value Axis Major Gridlines). I can’t find any field to remove it. I attached file with example presentation with chart.

Best Regards,


Hi Piotr,

Thanks for inquiring Aspose.Slides.

Please use the following code snippet for removing the chart Major and Minor grid lines for both Category and Value axis. Please share, if I may help you further in this regard.

public static void RemoveGridLines()
String path = “D:\Aspose Data\”;

PresentationEx pres = new PresentationEx(path + “To aspose.pptx”);
SlideEx slide = pres.Slides[0];
ShapeEx sh = slide.Shapes[0];

if (sh is ChartEx)
ChartEx chart = (ChartEx)sh;
chart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
chart.SecondCategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
chart.SecondCategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;

chart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;

chart.SecondValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
chart.SecondValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.NoFill;

pres.Write(path + “ModifiedChart.pptx”);


Many Thanks,


Thanks! Your solution works great!