mar*_*c_s 2 openxml-sdk c#-4.0 powerpoint-2010
我正在尝试.pptx使用OpenXML SDK 2.0 分析现有的PowerPoint 2010 文件.
我想要达到的目标是
我已经开始并且到目前为止 - 我可以枚举SlideParts来自PresentationPart- 但我似乎无法找到一种方法来使这个有序的枚举 - 幻灯片以几乎任意的顺序返回...
按照PPTX文件中定义的顺序获取这些幻灯片的任何技巧?
using (PresentationDocument doc = PresentationDocument.Open(fileName, false))
{
// Get the presentation part of the document.
PresentationPart presentationPart = doc.PresentationPart;
foreach (var slide in presentationPart.SlideParts)
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
我希望找到类似于SlideID或Sequence数字之类的东西 - 我可以在Linq表达式中使用的某些项目或属性
.OrderBy(s => s.SlideID)
Run Code Online (Sandbox Code Playgroud)
在那个slideparts集合上.
这比我希望的要多一些 - 而且有时候文档有点粗略......
基本上,我不得不列举SlideIdList的PresentationPart和做一些XML-FOO从获取SlideId到的OpenXML的演示文稿的幻灯片实际.
有点像:
using (PresentationDocument doc = PresentationDocument.Open(fileName, false))
{
// Get the presentation part of the document.
PresentationPart presentationPart = doc.PresentationPart;
// get the SlideIdList
var items = presentationPart.Presentation.SlideIdList;
// enumerate over that list
foreach (SlideId item in items)
{
// get the "Part" by its "RelationshipId"
var part = presentationPart.GetPartById(item.RelationshipId);
// this part is really a "SlidePart" and from there, we can get at the actual "Slide"
var slide = (part as SlidePart).Slide;
// do more stuff with your slides here!
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1775 次 |
| 最近记录: |