5,139
社区成员
发帖
与我相关
我的任务
分享
//Get Each Section of Document
foreach (Section section in document.Sections)
{ //Get Each Paragraph of Section
foreach (Paragraph paragraph in section.Paragraphs)
{
//Get Each Document Object of Paragraph Items
foreach (DocumentObject docObject in paragraph.ChildObjects)
{
//If Type of Document Object is Picture, Extract.
if (docObject.DocumentObjectType == DocumentObjectType.Picture)
{
DocPicture picture = docObject as DocPicture;
//Name Image
String imageName = String.Format(@"images\Image-{0}.png", index);
//Save Image
picture.Image.Save(imageName, System.Drawing.Imaging.ImageFormat.Png);
index++;
}
}
}
}
LZ可以看下这段代码,尽管它使用C# Word作为组件,但代码还是能给你一点启示吧