Message-ID: <88934546.8049.1711630247836.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8048_1622341215.1711630247836" ------=_Part_8048_1622341215.1711630247836 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
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.
=20public void BindRowData(System.Data.DataView dataSource, System.String dat= aSourceName, DataBindingProperties property)=20
Public Sub BindRowData(ByVal dataSource As System.Data.DataView, ByVal data= SourceName As String, ByVal [property] As DataBindingProperties)=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.=20
BindRowData
will throw this exception if=20
null
(C#) or=20
Nothing
(VB.NET) is passed to the method.=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.
=20You 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.
=20ExcelTemplate 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
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