Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

Sets a column's

...

data

...

source

...

to

...

an

...

Msdn

...

System.Collections.IDictionary

...

System.Collections.IDictionary
1IDictionary
. An IDictionary represents a collection of key-and-value pairs.

Signature
C#
C#
 public virtual void BindColumnData(System.Collections.IDictionary dataSource, System.String dataSourceName, DataBindingProperties property)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Overridable Sub BindColumnData(ByVal dataSource As System.Collections.IDictionary, ByVal dataSourceName As String, ByVal [property] As DataBindingProperties)
{signature}
{parameters}
{param:dataSource}An {{IDictionary}} collection of key\-and\-value pairs.{param}
{param:dataSourceName}The name of the template data marker at which to insert the values imported from the data source.{param}
{param:property}The [DataBindingProperties|DataBindingProperties] object which contains information about how the data should be bound to the template. {{property}} Must be specified, but the {{DataBindingProperties}} need not be set beforehand. To bind data to a template with the default {{DataBindingProperties}}, pass in {{ExcelTemplate.CreateDataBindingProperties()}} as the {{property}} value. Otherwise, use the {{ExcelTemplate.CreateDataBindingProperties()}} method to generate a new {{DataBindingProperties}} object and set the [DataBindingProperties.MaxRows|DataBindingProperties.MaxRows], [DataBindingProperties.Transpose|DataBindingProperties.Transpose], and/or [DataBindingProperties.WorksheetName|DataBindingProperties.WorksheetName] properties for the workbook.{param}
{exceptions}
{exception:ArgumentNullException}{{BindColumnData}} will throw this exception if {{null}} \(C\#\) or {{Nothing}} \(VB.NET\) is passed to the method.{exception}
{exception:ArgumentException}{exception}
{remarks}You can set several data sources for a single template. Use the following methods to set template data sources: [BindCellData|ExcelTemplate.BindCellData(Object, String, DataBindingProperties)], [BindColumnData|ExcelTemplate.BindColumnData], [BindRowData|ExcelTemplate.BindRowData], and [BindData|ExcelTemplate.BindData].

{remarks}
{example}{code:csharp|title=C#}
Parameters
Param
dataSource
dataSource

An IDictionary collection of key-and-value pairs.

Param
dataSourceName
dataSourceName

The name of the template data marker at which to insert the values imported from the data source.

Param
property
property

The DataBindingProperties object which contains information about how the data should be bound to the template. property Must be specified, but the DataBindingProperties need not be set beforehand. To bind data to a template with the default DataBindingProperties, pass in ExcelTemplate.CreateDataBindingProperties() as the property value. Otherwise, use the ExcelTemplate.CreateDataBindingProperties() method to generate a new DataBindingProperties object and set the DataBindingProperties.MaxRows, DataBindingProperties.Transpose, and/or DataBindingProperties.WorksheetName properties for the workbook.

Exceptions
Exception
ArgumentNullException
ArgumentNullException

BindColumnData will throw this exception if null (C#) or Nothing (VB.NET) is passed to the method.

Exception
ArgumentException
ArgumentException

Remarks

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

Example
Code Block
csharp
csharp
titleC#


          //--- Set a column data source for the data marker
          //--- %%=$Products
          xlt.BindColumnData(coll,
               "Products",
               xlt.CreateDataBindingProperties());
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Set a column data source for the data marker
          '--- %%=$Products
          xlt.BindColumnData(coll, _
               "Products", _
               xlt.CreateDataBindingProperties())
        
{code} {example}