[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Workbook.AddDataSource

AddDataSource Method

AddDataSource(string, object)

Adds a data source for template processing.

Declaration
public void AddDataSource(string name, object dataSource)
Public 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.

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