Single complex object as data source

Hi Aspose Team,

We use Aspose.Cells for Java and faced with following requirement - generate Excel (xlsx) file from complex template.

This archive contains simplified template with 3 sheets - template, data source and expected target file content.
test.zip (9.4 KB)

As we can see, it is may be possible via Smart Markers, but is there any way to not to use array-like structures for fields like deal.totalAmount and deal.client.name?

@ivkond,
You may try importing data from JSON file using the following sample code and share your feedback.

// Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

// Read File
string jsonInput = File.ReadAllText(dataDir + "Test.json");

// Set Styles
CellsFactory factory = new CellsFactory();
Style style = factory.CreateStyle();
style.HorizontalAlignment = TextAlignmentType.Center;
style.Font.Color = System.Drawing.Color.BlueViolet;
style.Font.IsBold = true;

// Set JsonLayoutOptions
JsonLayoutOptions options = new JsonLayoutOptions();
options.TitleStyle = style;
options.ArrayAsTable = true;

// Import JSON Data
JsonUtility.ImportData(jsonInput, worksheet.Cells, 0, 0, options);

// Save Excel file
workbook.Save(dataDir + "ImportingFromJson.out.xlsx");

test.json.zip (1.0 KB)
test.xlsx.zip (6.7 KB)