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

Free Support Forum - aspose.com

chart.AxisX.CategoryType not work with my template

my code:
var document = new Document(@“C:\default.docx”);
var builder = new DocumentBuilder(document);

        builder.MoveToDocumentEnd();
        var shape = builder.InsertChart(ChartType.Line, 448, 300);
        var chart = shape.Chart;
        chart.Title.Show = false;
        chart.Legend.Overlay = false;
        chart.Legend.Position = LegendPosition.Bottom;
        chart.AxisX.CategoryType = AxisCategoryType.Category;
        document.Save("d:\\test.docx");

the result of xAxis:
image.png (1.7 KB)

it works with empty document, but no my template.
this is my template: default.zip (188.1 KB)

version:18.2.0.0

@qingyuan.ni,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16611. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@qingyuan.ni,

Thanks for your patience. We have completed the analysis of this issue. On opening a document MS Word may change value of the ChartAxis.CategoryType property depending on chart data. It seems that its behavior depends on MS Word version in which a document is created (on value of the AppVersion property in the app.xml document part). If version is higher than 12.0, MS Word may change category type. The default.docx document has 16 as AppVersion; for created documents Aspose.Words writes the 12.0 version.

You can use the following code to prevent changing value of this property. Hope this helps you.

document.BuiltInDocumentProperties.Version = 0x0C0000;
document.Save(MyDir + @"out.docx");

If you still face problem, please share complete detail of your use case along with usage of this property that you are using at your end. Thanks for your cooperation.