[]
Adds a data source for template processing.
public void AddDataSource(string name, object dataSource)
Public Sub AddDataSource(name As String, dataSource As Object)
| Type | Name | Description |
|---|---|---|
| string | name | The alias name of the data source used by template binding fields. |
| object | dataSource | The data source to register. Common choices include a JsonDataSource, a DataTable, a DataSet, an ITableDataSource, a custom object or object collection, or a scalar value such as a string, number, or date. |
worksheet.Range["A1"].Value = "{{title}}";
string reportTitle = "Sales Report";
workbook.AddDataSource("title", reportTitle);
workbook.ProcessTemplate();
object value = worksheet.Range["A1"].Value;