Intro
Excerpt |
---|
This guide will explain how to import a single row of values into a PowerPoint presentation using data markers. This assumes a basic understanding of data markers. |
| ||||||
---|---|---|---|---|---|---|
|
Binding Data
PowerPointTemplate has a single method for binding data to the data markers that are located in the template: PowerPointTemplate.BindData
. Depending on the data source type and the number of rows in the data source, PowerPointWriter will either import a single row of data or import multiple rows by repeating sections of the presentation.
...
Wiki Markup |
---|
h2. Intro {excerpt}This guide will explain how to import a single row of values into a PowerPoint presentation using data markers. This assumes a basic understanding of [data markers|How to use Data Markers].{excerpt} || {center} Jump to: {center} || | {toc:minLevel=2|maxLevel=4} | h2. Binding Data PowerPointTemplate has a single method for binding data to the data markers that are located in the template: {{[PowerPointTemplate.BindData]}}. Depending on the data source type and the number of rows in the data source, PowerPointWriter will either import a single row of data or [import multiple rows|Importing Multiple Rows of Data] by repeating sections of the presentation. By default, every appearance of a data marker will be populated with the same data. For example, if %%=Header.CompanyLogo(image) appears on multiple slides, each data marker will be populated with the company logo. This behavior can be overwritten using [data binding properties |
...
Types of Data Sources
Arrays of objects
Methods:
|How to Use Data Binding Properties]. h2. Types of Data Sources h4. Arrays of objects Methods: * {{\[PowerPointTemplate.BindData(Object\[\],String\[\],String,DataBindingProperties) |
...
\]}} * {{\[PowerPointTemplate.BindData(Object\[\]\[\],String\[\],String,DataBindingProperties) |
...
\]}} * {{\[PowerPointTemplate.BindData(Object{}}}{{[,]}}{{,String\[\],String,DataBindingProperties)\] |
...
}} Arrays don't have built-in means to store column names. The user must specify the column names in a string array that is passed to {{PowerPointTemplate.BindData}} at run time. |
...
If a multidimensional array ({{Object\[,\]}}) or a jagged array ({{Object\[\]\[\]}}) contains multiple rows, PowerPointWriter will import all the rows using built-in repeating behavior. To import a single row of data using a multidimensional or jagged array, the array can only contain a single row of data. For more information about using arrays to import multiple rows of data, please see [Importing Multiple Rows of Data |
...
Example:
One dimensional array:
Code Block | ||||
---|---|---|---|---|
csharp | csharp | |||
title | C# | ].
{examples}
One dimensional array:
{code:csharp|title=C#}
PowerPointTemplate pptt = new PowerPointTemplate();
pptt.Open(@"C:\DataBinding\ArrayBindingTemplate.pptx");
string[] values = {"Hello World", "subtitle"};
string[] colNames = {"header", "subtitle"};
DataBindingProperties DataProps = pptt.CreateDataBindingProperties();
pptt.BindData(values, colNames, "DataSource1", DataProps);
pptt.Process();
pptt.Save(Page.Response,
"ArrayBinding.pptx",
false);
| ||
Code Block | ||||
vbnet | vbnet | title | {code} {code:vbnet|title=vb.net | } Dim pptt As New PowerPointTemplate() pptt.Open("C:\DataBinding\ArrayBindingTemplate.pptx") Dim values = New String() {"Hello World", "subtitle"} Dim colNames = New String() {"header", "subtitle"} Dim DataProps As DataBindingProperites = pptt.CreateDataBindingProperties(); pptt.BindData(values, colNames, "DataSource1", DataProps); pptt.Process() pptt.Save(Page.Response, _ "ArrayBinding.pptx", _ False) {code} Two dimensional array: |
...
{code | ||||
:csharp | csharp | |title | =C# | }
string[][] twodim = {
new string[]{"Watertown", "MA", "02472"},
new string[]{"Washington", "DC", "20500"}
};
string[] names = {"City", "State", "Zip"};
pptt.BindData(twodim,
names,
"TwoDimArray",
pptt.CreateDataBindingProperties());
pptt.Process();
pptt.Save(Page.Response,
"ArrayBinding.pptx",
false);
|
Code Block | ||||
---|---|---|---|---|
vbnet | vbnet | title | {code} {code:vbnet|title=vb.net | }
Dim twodim()() As String = New String()() { _
New String(){"Watertown", "MA", "02472"}, _
New String(){"Washington", "DC", "20500"}, _
}
Dim names As String() = {"City", "State", "Zip"}
pptt.BindData(twodim, _
names, _
"TwoDimArray", _
pptt.CreateDataBindingProperties())
pptt.Process()
pptt.Save(Page.Response, _
"ArrayBinding.pptx", _
False)
|
Custom objects
TO FILL IN AFTER THE MULTIPLE ROWS WITH NOTE ABOUT "ONLY 1 ROW OF DATA"
Data Readers and Data Tables
...
{code} {examples} h4. Custom objects TO FILL IN AFTER THE MULTIPLE ROWS WITH NOTE ABOUT "ONLY 1 ROW OF DATA" h4. Data Readers and Data Tables TO FILL IN AFTER THE MULTIPLE ROWS WITH NOTE ABOUT "ONLY 1 ROW OF DATA" |