Page tree

Versions Compared

Key

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

...

Note

This is Part 2 of a 3-part tutorial series for the Project Proposal New Employee Training scenario. It is recommended that you complete Part 1 - Getting StartedImporting Data before starting this section.

...

Note

For information on writing this code, see Part 1 - Getting StartedImporting Data.

Code Block
//Code from Part 1
PowerPointTemplate pptt = new PowerPointTemplate();
pptt.Open(Page.MapPath("//templates//part1_template.pptx"));
DataBindingProperties dataProps = pptt.CreateDataBindingProperties();
string[] columnNamesArray = {"Logo"};
Byte[] logoArray = System.IO.File.ReadAllBytes((Page.MapPath("//data//logo.png")));
object[] valuesArray = {logoArray};
pptt.BindData(valuesArray, columnNamesArray, "Company", dataProps);
string[] employeeColNames = {"Name", "Team"};
                object[] employeeValues = {"Amy Alberts", "Development"};
pptt.BindData(employeeValues, employeeColNames, "Employee", dataProps);
DataTable teamData = GetCSVData((Page.MapPath("//data//Team.csv")));
pptt.BindData(teamData, "Team", dataProps);
 //Code from Part 2
DataTable dtCompanyHistory = GetCSVData(Page.MapPath("//data//CompanyHistory.csv"));
dataProps.MaxRowsPerSlide = 5;
pptt.BindData(dtCompanyHistory, "CompanyHistory", dataProps);
DataTable dtProducts = GetCSVData(Page.MapPath("//data//Products.csv"));
dataProps.MaxRowsPerSlide = 2;
pptt.BindData(dtProducts, "Products", dataProps);
pptt.Process();
pptt.Save(Page.Response, "Part2_Output.pptx", false);

...