检查Word文档中是否存在特定图像 [英] Check whether a particular image is present in a Word document

查看:131
本文介绍了检查Word文档中是否存在特定图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们有一个项目要求,我们需要检查Word/Excel文档中是否存在特定图像.

注意:如果完全有图像存在,它将出现在文档末尾.

例如,我们有一个Word文档(Word.docx)和一个图像(Image1.jpg).我需要检查Word文档"Word.docx"是否最后包含图像"Image1.jpg".

请注意,我正在使用编程语言C#

我在相当长的一段时间内都在为这个问题而苦苦挣扎.我找不到来自互联网的适当帮助.
任何人都可以帮助我实现这一目标吗?

在此先感谢,
Kishor Reddy

解决方案

使用Interop,
Please note that i am using programming language C#

I am struggling with this issue from quite some time. I could not find appropriate help from internet.
Can anyone help me acheiving this ?

Thanks in Advance,
Kishor Reddy

解决方案

Using Interop, the InlineShapes[^] of the document should contain the pictures so if you loop through that, you should find the pictures.


using InlineShapes, i got the last image of the word document. and compared the pixels of both the images (the last image of the word document and the other image).

Steps:
1. Get the last image of the document using InlineShapes
2. Convert to bitmap.
3. Convert each pixel of the custom image.
4. If all the pixels are equal, then both the images are same.

Sometimes, based on the Word properties, borders are added to the embedded image. While comparing the pixels, we need to ignore the pixels related to the borders.

thanks....


这篇关于检查Word文档中是否存在特定图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆