Message-ID: <1059189224.8107.1711632154731.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8106_150963133.1711632154731" ------=_Part_8106_150963133.1711632154731 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html ExcelTemplate.BindRowData(System.Data.DataSet, String, DataBindi= ngProperties)

ExcelTemplate.BindRowData(System.Data.DataSet, String, DataBindingP= roperties)

Description

Sets a DataSet as a data source to bind to a row in the template. &n= bsp; This method will import only the first row of the first DataTable of t= he DataSet.   You must insert a datamarker into the template for = each column of data you want shown.=20
C#
=20
 public void BindRowData(System.Data.DataSet da=
taSource, System.String dataSourceName, DataBindingProperties property)
=20
=20
vb.net
=20
Public Sub BindRowData(ByVal dataSource As Syste=
m.Data.DataSet, ByVal dataSourceName As String, ByVal [property] As DataBin=
dingProperties)
=20

Parameters

=20
source
The DataSet to use as the data source.=20
dataSourceName
The name of the data marker = at which to insert the values imported from the data source. For example, t= o bind a data source to the data marker %%=3DOrders.OrderId, the value of d= ataSourceName should be "Orders". The string passed must begin wi= th a letter.=20
property
The=20 DataBinding= Properties object which contains information about how the data should = be bound to the template.=20 property Must be specified, but the=20 DataBindingProperties need not be set beforehand. To bind data= to a template with the default=20 DataBindingProperties, pass in=20 ExcelTemplate.CreateDataBindingProperties() as the=20 property value. Otherwise, use the=20 ExcelTemplate.CreateDataBindingProperties() method to generate= a new=20 DataBindingProperties object and set the=20 Dat= aBindingProperties.MaxRows,=20 D= ataBindingProperties.Transpose, and/or=20 DataBindingProperties.WorksheetName properties for the workbook.

Exceptions

=20
ArgumentNullException
=20 BindRowData will throw this exception if=20 null (C#) or=20 Nothing (VB.NET) is passed to the method.=20
ArgumentException
 

Remarks

=20

Only the first row of the DataSet will be used. This method is commonly = used to create a set of key-value pairs via a single row of data.

You can set several data sources for a single template. Use the followin= g methods to set template data sources: BindCellData, BindColumnData, BindRowData, and Bin= dData.

=20

Examples

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

          //--- Bind the DataSet to the
          //--- %%=3DOrders.[Field] data marker.
          xlt.BindRowData(OrdersDS,
               "Orders",
               xlt.CreateDataBindingProperties());
          xlt.Process();
          xlt.Save(Page.Response, "EmployeeOrders.xls", false);
        
=20
vb.net
=20
          Dim xlt As New ExcelTemplate()
          xlt.Open("C:\ExcelWriter\EmployeeOrdersTemplate.xls")

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

------=_Part_8106_150963133.1711632154731--