Aspose.Word从word文档里提取图片

Aspose.Word从word文档里提取图片

2023年7月3日发(作者:)

从word文档里提取图片

是一款功能强大的word控件,可以对word文件进行创建、编辑、读取、修改、转换,合并,插入等操作,并且不需要安装任何第三方插件,下面我们简单介绍,如果从word文件中提取图片并保存。控件中国网是在中国地区的核心代理商

具体查看下面的代码:

C#

public void ExtractImagesToFiles()

{

Document doc = new Document(MyDir + "");

NodeCollection shapes = ldNodes(, true);

int imageIndex = 0;

foreach (Shape shape in shapes)

{

if (ge)

{

string imageFileName = (

"Images.{0} Out{1}", imageIndex,

ypeToExtension(ype));

(MyDir + imageFileName);

imageIndex++;

}

}

// Newer Microsoft Word documents (such as DOCX) may contain a different type of image

container called DrawingML.

// Repeat the process to extract these if they are present in the loaded document.

NodeCollection dmlShapes = ldNodes(gML, true);

foreach (DrawingML dml in dmlShapes)

{

if (ge)

{

string imageFileName = (

"Images.{0} Out{1}", imageIndex,

ypeToExtension(ype));

(MyDir + imageFileName);

imageIndex++;

}

}

}

Visual Basic Public Sub ExtractImagesToFiles()

Dim doc As New Document(MyDir & "")

Dim shapes As NodeCollection = ldNodes(, True)

Dim imageIndex As Integer = 0

For Each shape As Shape In shapes

If ge Then

Dim imageFileName As String = ("Images.{0} Out{1}",

imageIndex, ypeToExtension(ype))

(MyDir & imageFileName)

imageIndex += 1

End If

Next shape

' Newer Microsoft Word documents (such as DOCX) may contain a different type of image

container called DrawingML.

' Repeat the process to extract these if they are present in the loaded document.

Dim dmlShapes As NodeCollection = ldNodes(gML, True)

For Each dml As DrawingML In dmlShapes

If ge Then

Dim imageFileName As String = ("Images.{0} Out{1}",

imageIndex, ypeToExtension(ype))

(MyDir & imageFileName)

imageIndex += 1

End If

Next dml

End Sub

发布者:admin,转转请注明出处:http://www.yc00.com/news/1688382832a129717.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信