...
Code Block |
---|
|
string[] onedim = {"SoftArtisans", "OfficeWriter", "ExcelTemplate"};x
xltlt.BindColumnData(onedim, "SimpleArray",xlt.CreateDataBindingProperties()); |
...
ExcelTemplate.BindColumnData sets a data source for a template column to a 1-dimensional array of objects. The method's first parameter, onedim, is the data source array. The second parameter, "SimpleArray", is the name of the template data marker to which the data source binds. The third parameter, xlt.CreateDataBindingProperties(), is a DataBindingProperties object that contains values that change how the data are bound to the template; in this case, the default property values are used.
The method BindData binds the data markers *%%=TwoDimArray.#1*, *%%=TwoDimArray.#2*, and *%%=TwoDimArray.#3* to a 2-dimensional string array:
...
Data Marker | Code |
---|
%%=$SimpleArray | Code Block |
---|
| string[] onedim = {"SoftArtisans",
"OfficeWriter",
"ExcelTemplate"};
xlt.BindColumnData(onedim,
"SimpleArray",
xlt.CreateDataBindingProperties()); |
Code Block |
---|
| Dim onedim As String() = {"SoftArtisans", _
"OfficeWriter", _
"ExcelTemplate"}
xlt.BindColumnData(onedim, _
"SimpleArray", _
xlt.CreateDataBindingProperties()) |
|
%%=TwoDimArray.#1 %%=TwoDimArray.#2 %%=TwoDimArray.#3
| Code Block |
---|
| string[][] twodim = {
new string[]{"Nancy", "Davolio", "Sales Manager"},
new string[]{"Michael", "Suyama", "HR Representative"},
new string[]{"Adrian",
"King",
"IS Support"}
};
string[] names = {"FirstName", "LastName", "Position"};
xlt.BindData(twodim,
names,
"TwoDimArray",
xlt.CreateDataBindingProperties()); |
Code Block |
---|
| Dim twodim()() As String = New String()() { _
New String(){"Nancy", "Davolio", "Sales Manager"}, _
New String(){"Michael", "Suyama", "HR Representative"}, _
New String(){"Adrian", _
"King", _
"IS Support"}
}
Dim names As String() = {"FirstName", "LastName", "Position"}
xlt.BindData(twodim, _
names, _
"TwoDimArray", _
xlt.CreateDataBindingProperties()) |
|
%%=Address.Street | Code Block |
---|
| string[] addressvalues = {"3 Brook St.",
"Watertown",
"MA"};
string[] addressnames = {"Street", "City", "State"};
xlt.BindRowData(addressvalues,
addressnames,
"Address",
xlt.CreateDataBindingProperties()); |
Code Block |
---|
| Dim addressvalues As String() = {"3 Brook St.", _
"Watertown", _
"MA"}
Dim addressnames As String() = {"Street", "City", "State"}
xlt.BindRowData(addressvalues, _
addressnames, _
"Address", _
xlt.CreateDataBindingProperties() |
|