Page tree

Versions Compared

Key

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

...

Excerpt

Sets a DataSet as a data source to bind to a row in the template.


This method will return only one row of data for the column bound by the datamarker. You must insert a datamarker for each column you want shown in the template.

Signature
C#
C#
 public void BindRowData(System.Data.DataSet dataSource, System.String dataSourceName, DataBindingProperties property)

...

Example
Code Block
csharp
csharp
titleC#

          ExcelTemplate xlt = new ExcelTemplate();
          xlt.Open(@"C:\ExcelWriter\EmployeeOrdersTemplate.xls");

              //--- Bind the DataSet to the
          //--- %%=Orders.[Field] data marker.
          xlt.BindRowData(OrdersDS,
               "Orders",
               xlt.CreateDataBindingProperties());
          xlt.Process();
          xlt.Save(Page.Response, "EmployeeOrders.xls", false);
        
Code Block
vb.net
vb.net
titlevb.net

          Dim xlt As New ExcelTemplate()
          xlt.Open("C:\ExcelWriter\EmployeeOrdersTemplate.xls")

              '--- Bind the DataSet to the
          '--- %%=Orders.[Field] data marker.
          xlt.BindRowData(OrdersDS, _
               "Orders", _
               xlt.CreateDataBindingProperties())
          xlt.Process()
          xlt.Save(Page.Response, "EmployeeOrders.xls", False)