Page tree

Versions Compared

Key

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

...

Setting up the template file

The template file for Hello World can be found under 1. Create a new .XLSX file. Save it as template.xlsx.

Info

In the sample code, the completed template file is located in \templates\Hello World.xlsx.

2. We are going to bind a single string value to a cell in a template file. To do this, we will first need to add a data marker to the cell where we want the value to appear.

We've already added the single data marker '%%=$DataValue' to the Hello World.xlsx template file. All ExcelWriter data markers are prefaced with '%%=' and the additional '$' sign means that the data source for this data marker is 1-dimensional (e.g. 1-dimensional array or single value). 'DataValue' is the data marker ID we'll use to bind the data to this data marker.

Info

We've already added the single data marker '%%=$DataValue' to the Hello World.xlsx template file.

3. Now the template file is done. Next is writing the code to bind the string value to the data marker.

...

You can download the code for the hello world tutorial as a Visual Studio solution.