Aspose Word Chart Error "Index was outside the bounds of the array."

output.json

[
  {
    "Name": "Monday",
    "Sections": [
      {
        "Name": "CAT1",
        "StackedCharts": [
          [
            {
              "Name": "A",
              "Value": 1
             
            },
            {
              "Name": "B",
              "Value": 0
             
            },
            {
              "Name": "C",
              "Value": 0
             
            }
          ]
        ]
      },
      {
        "Name": "CAT2",
        "StackedCharts": [
          [
            {
              "Name": "A",
              "Value": 0.9
             
            },
            {
              "Name": "B",
              "Value": 0.1
             
            },
            {
              "Name": "C",
              "Value": 0
             
            }
          ]
        ]
      }
    ]
  },
  {
    "Name": "Tuesday",
    "Sections": [
      {
        "Name": "CAT1",
        "StackedCharts": [
          [
            {
              "Name": "A",
              "Value": 1
             
            },
            {
              "Name": "B",
              "Value": 0
             
            },
            {
              "Name": "C",
              "Value": 0
             
            }
          ]
        ]
      },
      {
        "Name": "CAT2",
        "StackedCharts": [
          [
            {
              "Name": "A",
              "Value": 0.9
             
            },
            {
              "Name": "B",
              "Value": 0.1
             
            },
            {
              "Name": "C",
              "Value": 0
             
            }
          ]
        ]
      }
    ]
  }
]

Main.cs

using Aspose.Words;
using Aspose.Words.Reporting;
using System.Text.Json;
using Document = Aspose.Words.Document;


string jsonString = File.ReadAllText(@"C:\Users\output.json");
var listData = JsonSerializer.Deserialize<List<AllSections>>(jsonString);

Export export = new Export();
export.Details = listData;


//// Input directory
License license = new License();
var licensePath = "Aspose.Words.NET.lic";
license.SetLicense(licensePath);

string dataDir = @"C:\Users\inputq.docx";

// Build Aspose
Document doc = new Document(dataDir);
ReportingEngine engine = new ReportingEngine();

engine.BuildReport(doc, export, "ds");

// START CHECKING OF EMPTY PAGE
var totalPages = doc.PageCount; // <------ ERROR LINE
for (int i = 0; i < totalPages; i++)
{
    Document onePageDoc = doc.ExtractPages(i, 1); // <------ ERROR LINE
}

// Output directory
dataDir = @"C:\Users\AsposeWord_Test_Output.docx";

// Save the output
doc.Save(dataDir);

Console.WriteLine("Completed.");

public class Export
{
    public List<AllSections> Details { get; set; }
}

public class AllSections
{
    public string Name { get; set; }
    public List<Sections> Sections { get; set; }
}

public class Sections
{
    public string Name { get; set; }
    public List<List<StackedCharts>> StackedCharts { get; set; }
} 
public class StackedCharts
{
    public string Name { get; set; }
    public double Value { get; set; }

    public StackedCharts()
    {

    }
}

I keep hit Index was outside the bounds of the array. when try to generate the report. I have attached the json output file, and the report template.

inputq.docx (28.4 KB)
Expected_Output.docx (26.6 KB)

@leoteoh
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27702

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi,

I’ve subscribed the license key, but I just wanted to resolve the issues, kindly let me know here.

@leoteoh Sure, we will keep you informed and let you know once the issue is resolved or we have more information for you.

Hi @alexey.noskov ,

What’s the update?

@leoteoh The issue is already resolved in the current codebase. The fix will be included into the next 25.2 version of Aspose.Words. We will be sure to let you know once it is published.

Hi @alexey.noskov ,

May I know how often is the version roll out? Because I have little urgent for this fix.

@leoteoh We publish new version of Aspose.Words at the beginning of each month. So 25.2 version will be released at the beginning of the next month.