Covers:

Setting up the Template

About templates and data markers

An ExcelTemplate template is an Excel file that contains ExcelWriter data markers. A datamarker is a cell value beginning with %%= that specifies a database colum, variable, or array to insert into the spreadsheet column. Data markers are added to a worksheet in Excel and then bound to data sources in code. ExcelWriter populates the data markers with values from the data sources when the code is executed.

ExcelWriter templates do not necessarily need to be in the Excel template file format (XLT, XLTX, XLTM), although these formats are supported by ExcelWriter.

Datamarker syntax

The basic syntax for a datamarker is %%=DataSourceName.ColumnName, where DataSourceName is the name of the data source and ColumnName is the name of the column of data in the data source. You need to follow these rules when naming data markers:

Adding data markers to the the template

Writing the Code

Final Code

Downloads