Wiki Markup |
---|
{description} {excerpt}Sets an array of objects as a data source for a single column in the template.{excerpt} {signature:C#} public virtual void BindColumnData(System.Object[] columnData, System.String dataSourceName, DataBindingProperties property) {signature}{signature:vb.net} Public Overridable Sub BindColumnData(ByVal columnData As Object(), ByVal dataSourceName As String, ByVal [property] As DataBindingProperties) {signature} {parameters} {param:columnData}An array of objects to use as the data source.{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#} //--- Set a column data source for the data marker //--- %%=$SimpleArray string[] onedim = {"SoftArtisans", "OfficeWriter", "ExcelTemplate"}; xlt.BindColumnData(onedim, "SimpleArray", xlt.CreateDataBindingProperties()); {code} {code:vb.net|title=vb.net} '--- Set a column data source for the data marker '--- %%=$SimpleArray Dim onedim As String() = {"SoftArtisans", "OfficeWriter", "ExcelTemplate"} xlt.BindColumnData(onedim, _ "SimpleArray", _ xlt.CreateDataBindingProperties()) {code} {example} |
Page History
Overview
Content Tools