Table of Contents |
---|
Setting up the Template
About templates and data markers
A PowerPointWriter template is a PowerPoint presentation that contains PowerPointWriter data markers. A data marker is a line of text beginning with %%=
that specifies a database column, variable, or array to insert into the presentation. PowerPointWriter supports data markers embedded in text. Data markers are added to a presentation in PowerPoint and then bound to data sources in code. PowerPointWriter populates the data markers with values from the data sources when the code is executed. Part 1 of this tutorial demonstrates how to use data markers to import single rows of data.
Data marker syntax
The basic syntax for a data marker is %%=[DataSourceName].[ColumnName]
, where DataSourceName
is the name of the data source and ColumnName
is the name of the column in the data source. You need to follow these rules when naming data markers:
- Names must begin with a letter (A-Z, a-z)
- The brackets (
[
]
) are optional, but must be used when the data marker contains spaces or Unicode characters- The following is a list of characters allowed in data marker names without brackets: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_
- Names must exactly match the names in the data source.
- If a column in a database is 'Street Address', the
ColumnName
must be[Street Address]
to account for the space. Similarly, if a data source name is "DataSource1", the data marker name must beDataSource1
or[DataSource1]
.
- If a column in a database is 'Street Address', the
For more specific information about creating data markers, see How to use Data Markers
Adding data markers to the the template
The template for Part 1 consists of 6 slides populated with text and data markers.
Adding a PowerPointWriter Reference in Visual Studio
Create a .NET project and add a reference to the PowerPointWriter library.
- Open Visual Studio and create a .NET project.
- The sample code uses a web application.
- Add a reference to SoftArtisans.OfficeWriter.PowerPointWriter.dll
- SoftArtisans.OfficeWriter.PowerPointWriter.dll is located under Program Files > SoftArtisans > OfficeWriter > dotnet > bin
Writing the Code
Final Code
Downloads
You can download the code for the Basic PowerPointWriter Tutorials as a Visual Studio solution, which includes the Project Proposal.