...
Note |
---|
This is Part 2 of a 3-part tutorial series for the New Employee Training scenario. It is recommended that you complete Part 1 - Importing Data before starting this section. |
...
Code Block |
---|
DataTable dtProducts = GetCSVData(Page.MapPath("//data//Products.csv")); |
5. Reset Create a new DataBindingProperties object and set the MaxRowsPerSlide property so that the Products data fits on the slideto be 2
Code Block |
---|
dataProps.DataBindingProperties dataProps2 = pptt.CreateDataBindingProperties(); dataProps2.MaxRowsPerSlide = 2; |
6. Bind the Products data source to the presentation
Code Block |
---|
pptt.BindData(dtProducts, "Products", dataPropsdataProps2); |
7. Process the template to import the 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.DataBindingProperties dataProps2 = pptt.CreateDataBindingProperties(); dataProps2.MaxRowsPerSlide = 2; pptt.BindData(dtProducts, "Products", dataPropsdataProps2); pptt.Process(); pptt.Save(Page.Response, "Part2_Output.pptx", false); |
...