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

Free Support Forum - aspose.com

Process template with complex source

Hi, I would like to check how I can process a complex source that has a multiple properties, and some can be a simple object, and another can be a list
for example

var data = new {company = new Company {companyName}, employees = new List<Employees>{new employee {firstName, lastname,etc}}}

in this source, the companyName should be displayed as a header. and the employees are the rows of the file.
this is my code:

  // Initialize WorkbookDesigner object
            WorkbookDesigner designer = new WorkbookDesigner();
            // Load the template file
            designer.Workbook = new Workbook(templatePath);
            var company = new Company() {  Name = "test company" };

            // Specify the DataSource
            designer.SetDataSource("data", new { company, employees = data });
            // Process the markers

            // Save the Excel file.

I used this article:

this is my template:
image.png (35.1 KB)


Do you find any issue when working with smart markers for your requirements? If so, kindly do provide the following resource files:

  1. Your template Excel file (containing smart markers)
  2. Current output Excel file by Aspose.Cells APIs
  3. Sample (runnable) code that you are using
  4. Your expected output Excel file, you may create your expected Excel file in MS Excel manually

After getting the above resource files, we will evaluate your issue.

PS. please zip the files prior attaching here.

exmaple folder.zip (6.1 MB)

In the Zip file you can find:

  • template excel file
  • current output excel file
  • the code sample
  • excepted result

thank you


Please try the updated template Excel and sample code in the zipped archive (attached) to accomplish your task. Please note, Smart Markers feature has its own rules and grammar, so you have to follow up (see the documents on Smart Markers for your reference). Moreover, we cannot support your complex source data and files, so you might need to split them to simple data first (similar to our code and template file in the zipped archive).
files1.zip (9.1 KB)