日期:2014-05-19  浏览次数:20937 次

Word文档导出图片
如题,如何将Word文档中的所有图片导出。

------解决方案--------------------
没做过帮顶
------解决方案--------------------
帮顶下
------解决方案--------------------
是啊 是啊
同问 同问 顶上去~~!
------解决方案--------------------
不知道
------解决方案--------------------
在工程中引用Word,打开文件,使用Word对象集合中的InlineShapes获得图像对象集合,再进行处理即可。
------解决方案--------------------
帮顶
------解决方案--------------------
没作过,就帮楼住顶下,人气
------解决方案--------------------
帮顶下

------解决方案--------------------
接分
------解决方案--------------------
随后发给你。
------解决方案--------------------
楼主,别忘了把关键代码整出来
------解决方案--------------------
很简单 把他存为HTML 然后得到一个目录 遍历目录的图片 然后在删掉这个目录和HTML文件
------解决方案--------------------
DOC另存为HTML的代码

public string DocToHtml(string inFileName, string outFileName)
{
string OutPut = " ";
object fileName = inFileName;
object fileSaveName = outFileName;
object vk_read_only = false;
object vk_visible = true;
object vk_true = true;
object vk_false = false;
object vk_dynamic = 2;
object missing = System.Reflection.Missing.Value;
object vk_range = missing;
object vk_to = missing;
object vk_from = missing;
Word.ApplicationClass vk_word_app = new Word.ApplicationClass();
Word.Document aDoc = null;
try
{
aDoc = vk_word_app.Documents.Open(
ref fileName, ref missing, ref vk_read_only,
ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref vk_visible, ref missing, ref missing, ref missing, ref missing);
}
catch
{

OutPut += "There was a problem opening file!\n ";
}
try
{

//Get the word saveas format from the myItem object we got from the save as combo box selected item
object vk_saveformat = Word.WdSaveFormat.wdFormatFilteredHTML;

aDoc.SaveAs(ref fileSaveName, ref vk_saveformat, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
}
catch
{
OutPut += "Error ! ";
}

if (aDoc != null)
{
aDoc.Close(ref vk_false, ref missing, ref missing);
}

vk_word_app.Quit(ref vk_false, ref missing, ref missing);
vk_word_app = null;
GC.Collect();