Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Intro 

 

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} ||Jump to:|| | {toc:minLevel=2|maxLevel=3} | h2. Setting up the Template The template file should contain data markers following proper data marker syntax. Each copy of a given data marker will be populated with the same value. If the data marker appears in a table row or list entry, nothing will be automatically repeated if only one row is imported. h2. Binding Data PowerPointTemplate has a single method for binding data to the data markers that are located in the template:
Wiki Markup
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].

Table of Contents
maxLevel3
minLevel2

Setting up the Template

The template file should contain data markers following proper data marker syntax. Each copy of a given data marker will be populated with the same value. If the data marker appears in a table row or list entry, nothing will be automatically repeated if only one row is imported.

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].

...

There

...

are

...

several

...

ways

...

to

...

import

...

a

...

single

...

row

...

of

...

data

...

into

...

a

...

presentation:

...

  1. Use

...

  1. a

...

  1. single

...

  1. dimensional

...

  1. array
  2.  Use a multi-dimensional

...

  1. data

...

  1. source

...

  1. AND
    1. The data source only has one row of data
    2.  {{[DataBindingProperties.MaxRowsToImport]}}

...

    1. is

...

    1. set

...

    1. to

...

    1. 1

Single Dimensional Arrays

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.

...

:language=csharp}
Code Block
languagec#
             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}
{code:language=csharp}
Code Block
languagevb
		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.Repponse, "ArrayBinding.pptx", False)
{code}

h2. 

Multi-dimensional

...

data

...

sources

If a multi-dimensional

...

data

...

source

...

has

...

only

...

one

...

row

...

of

...

data,

...

the

...

automatic

...

repeating

...

behavior

...

will

...

not

...

occur.

...

This

...

is

...

consistent

...

for

...

any

...

of

...

the

...

multi-dimensional

...

data

...

sources

...

supported

...

by

...

[BindData|PowerPointTemplate.BindData]:

...

  •  Jagged and multi-dimensional

...

  • arrays 
  •  Custom objects (IEnumerable<T>)

...

  •  
  •  System.IDataReader

...

  • and

...

  • System.DataTable

...

Setting

...

MaxRowsToImport

...

to

...

1

...

MaxRowsToImport

...

is

...

a

...

property

...

on

...

the

...

[DataBindingProperties]

...

object

...

that

...

can

...

be

...

used

...

to

...

limit

...

the

...

number

...

of

...

rows

...

that

...

are

...

imported,

...

regardless

...

of

...

how

...

many

...

rows

...

are

...

actually

...

in

...

the

...

data

...

source.

...

Code Block
languagec#
DataBindingProperties dataProps = ppt.CreateDataBindingProperties();
dataProps.MaxRowsToImport = 1;
ppt.BindData(getDataTable(), "DataSourceName", dataProps);
{csharp}