Friday, 15 April 2011

c# 4.0 - Enumerating PowerPoint slides in order -



c# 4.0 - Enumerating PowerPoint slides in order -

i'm trying analyze existing powerpoint 2010 .pptx file using openxml sdk 2.0.

what i'm trying accomplish

enumerate slides in order (as appear in pptx) extracting textual bits each slide

i've started , gotten far - can enumerate slideparts presentationpart - cannot seem find way create ordered enumeration - slides beingness returned in pretty much arbitrary order...

any trick these slides in order defined in pptx file?

using (presentationdocument doc = presentationdocument.open(filename, false)) { // presentation part of document. presentationpart presentationpart = doc.presentationpart; foreach (var slide in presentationpart.slideparts) { ... } }

i hoping find slideid or sequence number or - item or property utilize in linq look like

.orderby(s => s.slideid)

on slideparts collection.

it's bit more involved had hoped - , docs bit sketchy @ times....

basically, had enumerate slideidlist on presentationpart , xml-foo slideid actual slide in openxml presentation.

something along lines of:

using (presentationdocument doc = presentationdocument.open(filename, false)) { // presentation part of document. presentationpart presentationpart = doc.presentationpart; // slideidlist var items = presentationpart.presentation.slideidlist; // enumerate on list foreach (slideid item in items) { // "part" "relationshipid" var part = presentationpart.getpartbyid(item.relationshipid); // part "slidepart" , there, can @ actual "slide" var slide = (part slidepart).slide; // more stuff slides here! } }

c#-4.0 openxml-sdk powerpoint-2010

No comments:

Post a Comment