Page tree

Versions Compared

Key

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

...

You can create an ExcelWriter template in Microsoft Excel or in script using the ExcelApplication object. Include data markers where you want to insert values. For example, if cell *B6* contains the data marker *%%=Orders.OrderID*, where Orders represents the Orders table in a database, ExcelWriter will import the *OrderID* column to column *B* in the spreadsheet.

 

TemplateSpreadsheet generated from the template

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

Note
In ExcelWriter versions before 3.1, data source and field numbers were 0-based.  If you upgraded from an earlier version, you may need to modify your code.

...

The following example generates a new spreadsheet from a template that contains two data markers: *%%=$RecipientName* and *%%=$RecipientCompany*. ExcelWriter sets the data sources for the template data markers to two simple string variables.

...