Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

data marker is a cell value or sheet tab name beginning

...

with %%=

...

 or %%=$

...

 that specifies a database column, a variable, or an array to insert in the spreadsheet column or sheet tab containing the marker. Data markers are created in Microsoft Excel and bound to data sources in code. When you run the code, ExcelWriter populates the data markers with values from a data source.

Refer to the ExcelTemplate Code Samples to see live demonstrations of various ExcelTemplate applications. Click the "View template" link on each sample page to see the template and view the Data Markers.

...

A data marker binds in script to a data source which may be a variable, an array, or an ADO.NET DataSet, DataTable, or DataReader. A data marker may include modifiers. Data source and field numbers are 1-based. If ExcelWriter encounters %%=#0[.field] or %%=[DataSource.]#0, an error will occur.

...

%%=Products.ProductID

The "ProductID" column of the data source "Products."

%%=#2.FirstName

The "FirstName" column of the second data source defined in the ExcelWriter code.

%%=Employee.#3

The third column of the "Employee" data source.

%%=#2.#3

The third column of the second data source defined in the ExcelWriter code.

Data Marker Names
Anchor
names
names

...

Note

In ExcelWriter 4, a $ was required for all data markers that bind to 1-dimensional arrays. In ExcelWriter 5 and above, if a 1-dimensional array binds to a row of data markers by the ExcelTemplate.SetRowDataSource or ExcelTemplate.BindRowData methods, the $ should be omitted. However, for backward compatibility, if you include the $, the data marker will be populated without error.

...