ExcelReportsGenerator generator = new ExcelReportsGenerator(); //Trial Mode
//ExcelReportsGenerator generator = new ExcelReportsGenerator("place user name here", "place license key here"); //License Mode
DataTable dataTable = new DataTable();
dataTable.Columns.Add("FirstName", typeof(string));
dataTable.Columns.Add("LastName", typeof(string));
dataTable.Columns.Add("Married", typeof(bool));
dataTable.Columns.Add("NumberOfChildren", typeof(int));
dataTable.Columns.Add("Salary", typeof(decimal));
dataTable.Columns.Add("BirthDate", typeof(DateTime));
DataRow employee1 = dataTable.NewRow();
employee1["FirstName"] = "John";
employee1["LastName"] = "Smith";
employee1["Married"] = true;
employee1["NumberOfChildren"] = 3;
employee1["Salary"] = 60000M;
employee1["BirthDate"] = new DateTime(1977, 12, 15);
dataTable.Rows.Add(employee1);
DataRow employee2 = dataTable.NewRow();
employee2["FirstName"] = "Joe";
employee2["LastName"] = "Jones";
employee2["Married"] = false;
employee2["NumberOfChildren"] = 0;
employee2["Salary"] = 30000M;
employee2["BirthDate"] = new DateTime(1993, 6, 25);
dataTable.Rows.Add(employee2);
using (FileStream outputStream = new FileStream("GenerateFromDataTableStreamExample.xlsx", FileMode.Create))
{
generator.GenerateFromDataTable(dataTable, "Employees", outputStream);
}