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

ExcelTemplate.BindRowData(System.Data.DataView, String, DataBinding= Properties)

Description

=20

Sets a DataView as a data source to bind to a row in the template.  = ;This method will import only the first row of the DataView.  You must= insert a datamarker into the template for each column of data you want sho= wn.

=20
C#
=20
 public void BindRowData(System.Data.DataView dataSource, System.String dat=
aSourceName, DataBindingProperties property)
=20
=20
vb.net
=20
Public Sub BindRowData(ByVal dataSource As System.Data.DataView, ByVal data=
SourceName As String, ByVal [property] As DataBindingProperties)
=20
=20

Parameters

=20
source
The DataView 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, = to bind a data source to the data marker %%=3DOrders.OrderId, the value of = dataSourceName should be "Orders". The string passed must begin w= ith a letter.=20
property
The=20 DataBindin= gProperties 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 Da= taBindingProperties.MaxRows,=20 = DataBindingProperties.Transpose, and/or=20 DataBindingProperties.WorksheetName properties for the workbook.=20

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
=20

Remarks

=20

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

=20

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

=20

Examples

=20
C#
=20

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

          //--- Bind the DataView to the
          //--- %%=3DOrders.[Field] data marker.
          xlt.BindRowData(OrdersDV,
               "Orders",
               xlt.CreateDataBindingProperties());
          xlt.Process();
          xlt.Save(Page.Response, "EmployeeOrders.xls", false);
        
=20
=20
vb.net
=20

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

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