[]
Processes the workbook as a template by evaluating template fields and replacing them with data from the workbook's data sources.
Call this method after adding one or more data sources with AddDataSource(string, object).
void ProcessTemplate()
Sub ProcessTemplate()
worksheet.Range["A1"].Value = "{{ds.name}}";
string json = "[{\"name\":\"jack\",\"age\":12,\"height\":160},{\"name\":\"alice\",\"age\":25,\"height\":165},{\"name\":\"peter\",\"age\":21,\"height\":180}]";
workbook.AddDataSource("ds", new JsonDataSource(json));
workbook.ProcessTemplate();
object value = worksheet.Range["A1"].Value;
Processes the workbook as a template and observes cancellation requests through the specified cancellation token.
Use this method to process template data in the current workbook while allowing the operation to be canceled through a CancellationToken.
void ProcessTemplate(CancellationToken cancellationToken)
Sub ProcessTemplate(cancellationToken As CancellationToken)
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token used to monitor cancellation requests. Use None if cancellation is not required. |
worksheet.Range["A1"].Value = "{{ds.name}}";
string json = "[{\"name\":\"jack\",\"age\":12,\"height\":160},{\"name\":\"alice\",\"age\":25,\"height\":165},{\"name\":\"peter\",\"age\":21,\"height\":180}]";
workbook.AddDataSource("ds", new JsonDataSource(json));
using (CancellationTokenSource cancellation = new CancellationTokenSource())
{
workbook.ProcessTemplate(cancellation.Token);
}
| Type | Condition |
|---|---|
| OperationCanceledException | Thrown if |