Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Wiki Markup
{introducedin:7.1.0.1855

...

Description

Excerpt

Sets a SharePoint View as a template data source.

Signature
C#C#
}
{description}
{excerpt}Sets a SharePoint View as a template data source.{excerpt}
{signature:C#}
public static void BindData(this ExcelTemplate template, Microsoft.SharePoint.SPView view, Microsoft.SharePoint.SPList list, String dataSourceName, DataBindingProperties properties)
Signature
{signature}{signature:vb.net
vb.net
}
Public Shared Sub BindData(ByVal template As ExcelTemplate, ByVal view As Microsoft.SharePoint.SPView, ByVal list As Microsoft.SharePoint.SPList, ByVal dataSourceName As String, ByVal properties As DataBindingProperties)
Parameters

...

The current ExcelTemplate object which is calling BindData

...

SharePoint View to use as a data source for the template.

...

SharePoint List associated with the SharePoint View

...

Name of the data source in the template.

...

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
This is an extension method for the ExcelTemplate object to be used for binding SharePoint data to spreadsheets from within SharePoint. To use this method, you must add a reference to
{signature}
{parameters}
{param:template}The current ExcelTemplate object which is calling BindData{param}
{param:view}SharePoint View to use as a data source for the template.{param}
{param:list}SharePoint List associated with the SharePoint View{param}
{param:dataSourceName}Name of the data source in the template.{param}
{param:properties}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}{{BindData}} 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].
{note}This is an extension method for the ExcelTemplate object to be used for binding SharePoint data to spreadsheets from within SharePoint.  To use this method, you must add a reference to SoftArtisans.OfficeWriter.ExcelWriter.SharePointIntegration.dll{note}
{remarks}
Exception
ArgumentNullExceptionArgumentNullException

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

Exception
ArgumentExceptionArgumentException
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.

Note