Message-ID: <758348039.9739.1711701141927.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9738_978404274.1711701141927" ------=_Part_9738_978404274.1711701141927 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Sets a row's data source to an =
IEnumerable collection. The IEnumerable
interface sup=
ports a simple iteration over a collection.
This method will return o=
nly one row of data for the column bound by the datamarker. You must insert=
a datamarker into the template for each column of data you want shown.
public virtual void BindRowData(System.Collections.IEnumerable dataSource,= System.String[] columnNames, System.String dataSourceName, DataBindingProp= erties property)=20
Public Overridable Sub BindRowData(ByVal dataSource As System.Collections.I= Enumerable, ByVal columnNames As String(), ByVal dataSourceName As String, = ByVal [property] As DataBindingProperties)=20
IEnumerable
collection to use as the data source.=20
columnNames
parameter is null, field binding can only be perfo=
rmed by ordinal (for example, %%=3DDSN.#1 or %%=3D$DSN). If=20
colNames
is specified, both ordinal field binding and named fi=
eld binding can be used.=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
BindRowData
will throw this exception if=20
null
(C#) or=20
Nothing
(VB.NET) is passed to the method.=20
ExcelTemplate xlt =3D new ExcelTemplate(); xlt.Open(@"C:\ExcelWriter\EmployeeOrdersTemplate.xls"); //--- Bind the IEnumerable collection to the //--- %%=3DOrders.[Field] data marker. xlt.BindRowData(OrdersColl, null, "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 IEnumerable collection to the '--- %%=3DOrders.[Field] data marker. xlt.BindRowData(OrdersColl, _ null, _ "Orders", _ xlt.CreateDataBindingProperties()) xlt.Process() xlt.Save(Page.Response, "EmployeeOrders.xls", False)=20