[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IWorkbook.AddDataSource

AddDataSource Method

AddDataSource(string, object)

Adds a data source for template processing.

Declaration
void AddDataSource(string name, object dataSource)
Sub AddDataSource(name As String, dataSource As Object)
Parameters
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.

Examples
worksheet.Range["A1"].Value = "{{title}}";
string reportTitle = "Sales Report";
workbook.AddDataSource("title", reportTitle);
workbook.ProcessTemplate();
object value = worksheet.Range["A1"].Value;