Message-ID: <1467073049.10055.1711710850290.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10054_961452611.1711710850290" ------=_Part_10054_961452611.1711710850290 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Table of Contents | =20
---|
=20
| =20
This part focuses on taking advantage of PowerPointWriter's Continue= modifier.
=20We are going to start with the template file as it was at the end of Par= t 1.
=20We will reuse the code from Part 1 of this tutorial. We will take out the Process and Save c= alls and add our new code for Part 2.
=20//Code from part 1 PowerPointTemplate pptt =3D new PowerPointTemplate(); pptt.Open(Page.MapPath("//templates//part1_template.pptx")); DataBindingProperties dataProps =3D pptt.CreateDataBindingProperties(); string[] columnNamesArray =3D {"Logo"}; Byte[] logoArray =3D System.IO.File.ReadAllBytes((Page.MapPath("//data= //logo.png"))); object[] valuesArray =3D {logoArray}; pptt.BindData(valuesArray, columnNamesArray, "Company", dataProps= ); string[] employeeColNames =3D {"Name", "Team"}; object[] employeeValues =3D {"Amy Alberts", "= ;Development"}; pptt.BindData(employeeValues, employeeColNames, "Employee", dataP= rops); DataTable teamData =3D GetCSVData((Page.MapPath("//data//Team.csv"= ;))); pptt.BindData(teamData, "Team", dataProps);=20
1. Get the data for the CompanyHistory.
=20 =20These calls are to a helper method GetCSVData
that parses t=
he CSV files and returns a DataTable
with the values.
If you are following in your own project and would like to parse the CSV= files as well, you will need to:
=20GenericParsing.dll
GeneringParsing
at the top of your code.GetCSVData
method that can be found in the sample =
code.DataTable dtCompanyHistory =3D GetCSVData(Page.MapPath("//data//COmpan= yHistory.csv"));=20
2. Set the MaxRowsPerSlide property. We will use the DataBindingProperti= es object created in Part 1 of this tutorial. Only 5 Company History items = will be on a single slide.
=20dataProps.MaxRowsPerSlide =3D 5;=20
3. Bind the CompanyHistory data to the presentation
=20pptt.BindData(dtCompanyHistory, "CompanyHistory", dataProps);=20
4. Get the data for the Products data source
=20DataTable dtProducts =3D GetCSVData(Page.MapPath("//data//Products.csv= "));=20
5. Create a new DataBindingProperties object and set the MaxRowsPerSlide= property to be 2
=20DataBindingProperties dataProps2 =3D pptt.CreateDataBindingProperties(); dataProps2.MaxRowsPerSlide =3D 2;=20
6. Bind the Products data source to the presentation
=20pptt.BindData(dtProducts, "Products", dataProps2);=20
7. Process the template to import the data
=20pptt.Process();=20
8.Save the final presentation and stream it in the response.
=20ppta.Save(pres, Page.Response, "Part2_Output.pptx", false);=20
//Code from Part 1 PowerPointTemplate pptt =3D new PowerPointTemplate(); pptt.Open(Page.MapPath("//templates//part1_template.pptx")); DataBindingProperties dataProps =3D pptt.CreateDataBindingProperties(); string[] columnNamesArray =3D {"Logo"}; Byte[] logoArray =3D System.IO.File.ReadAllBytes((Page.MapPath("//data= //logo.png"))); object[] valuesArray =3D {logoArray}; pptt.BindData(valuesArray, columnNamesArray, "Company", dataProps= ); string[] employeeColNames =3D {"Name", "Team"}; object[] employeeValues =3D {"Amy Alberts", "= ;Development"}; pptt.BindData(employeeValues, employeeColNames, "Employee", dataP= rops); DataTable teamData =3D GetCSVData((Page.MapPath("//data//Team.csv"= ;))); pptt.BindData(teamData, "Team", dataProps); //Code from Part 2 DataTable dtCompanyHistory =3D GetCSVData(Page.MapPath("//data//Compan= yHistory.csv")); dataProps.MaxRowsPerSlide =3D 5; pptt.BindData(dtCompanyHistory, "CompanyHistory", dataProps); DataTable dtProducts =3D GetCSVData(Page.MapPath("//data//Products.csv= ")); DataBindingProperties dataProps2 =3D pptt.CreateDataBindingProperties(); dataProps2.MaxRowsPerSlide =3D 2; pptt.BindData(dtProducts, "Products", dataProps2); pptt.Process(); pptt.Save(Page.Response, "Part2_Output.pptx", false);=20
You can download the code for the Basic PowerPointWriter Tutorials as a = Visual Studio solution, which includes the Project Proposal.
=20 =20Continue on to Part 3 - C= opy Slide