Chart Issues when Document is Saved as PDF

I found a couple of issues with charts created using ASPOSE Words that are saved as PDF.

The code below creates a simple column chart using a single series. The output in MS Word is correct, but if you save the same document as PDF, then there are two issues:

  1. The legend is displayed, but should not due to the LegendPosition.None setting.
  2. The data label for the last column is not displayed, but should display a zero.

I’m using ASPOSE Words v21.3.

Here’s the code to reproduce the issue:

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    Shape shape = builder.InsertChart(ChartType.Column, 432, 252);

    // Set chart options.
    Chart chart = shape.Chart;
    chart.Title.Text = "Simple Chart";
    chart.Legend.Position = LegendPosition.None;

    // Clear default series.
    ChartSeriesCollection seriesColl = chart.Series;
    seriesColl.Clear();

    // Add series data and options.
    string[] categories = new string[]
    {
        "1Q2020",
        "2Q2020",
        "3Q2020",
        "4Q2020"
    };
    double[] values = new double[]
    {
        477,
        475.75,
        480,
        0
    };
    ChartSeries series = seriesColl.Add("Test Series", categories, values);
    series.HasDataLabels = true;
    series.DataLabels.ShowValue = true;

    string folder = TestUtils.GetOutputFolder();
    string fileName = "SimpleColumnChart.docx";

    string filePath = Path.Combine(folder, fileName);
    doc.Save(filePath);
    Process.Start(filePath);

    filePath = filePath.Replace(".docx", ".pdf");
    doc.Save(filePath, SaveFormat.Pdf);
    Process.Start(filePath);

@Bill_Hanson

We have logged these issues as WORDSNET-22038 and WORDSNET-22039 in our issue tracking system. You will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-22039,WORDSNET-22038) have been fixed in this Aspose.Words for .NET 21.5 update and this Aspose.Words for Java 21.5 update.