I have a template document that contains a chart.
Using this template i generate a report.
It works fine when i have certain number of values, 7 in given example. but when the sample data increases the category axis looks clustered, As shown.
I would like to Dynamically set interval between labels to either automatic or specify the interval using formula, but i am unable to access this property.
I tried googling this but didn't help. I would appreciate if anybody could help me with this.
i have tested a solution and seems ok:
before test my word file:
see Axis Properties
my code:
using Word = Microsoft.Office.Interop.Word;
:
:
private void WordWithExcel()
{
object missing = System.Reflection.Missing.Value;
Word.Application application = new Word.Application();
Word.Document wordDoc = application.Documents.Add(@"d:\+test3.docx");
//i suppose there is only one inline -> always begin by 1 dunno why
Word.InlineShape shape = wordDoc.InlineShapes[1];
Word.Chart chart = shape.Chart;
var axis = chart.Axes(Word.XlAxisType.xlCategory);
axis.TickLabelSpacingIsAuto = false;
// if you want modify the spacing value
// axis.TickLabelSpacing = 2;
object filename = @"d:\++t.docx";
wordDoc.SaveAs2(ref filename);
wordDoc.Close(ref missing, ref missing, ref missing);
application.Quit(ref missing, ref missing, ref missing);
}
and the result: