当前位置:编程学习 > C#/ASP.NET >>

sql中的二进制图片导出到word中

请教各位,如何将sql数据库中以二进制流保存的图片直接导出到word文件中?
求教C#代码。 --------------------编程问答-------------------- 将二进制流读出来图片到指定的文件夹下,然后
利用函数
oWord.Selection.InlineShapes.AddPicture(ref name,ref LinkToFile,ref SaveWithDocument,ref Range);



object oMissing = System.Reflection.Missing.Value; 
object Range=System.Reflection.Missing.Value; 
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */ 
object name= "d:\\myfile.doc"; //你的文件名称

Word.Application oWord = new Word.ApplicationClass(); 
Word.Document oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,ref oMissing, ref oMissing);
oWord.Visible = true;  //打开
oWord.Selection.InlineShapes.AddPicture("e:/picture/123.jpg",ref oMissing,ref oMissing,ref Range);//插入图片
oWord.Selection.InlineShapes.Height=InchesToPoints(0.85);
oWord.Selection.InlineShapes.Width   =InchesToPoints(0.75);

给你地址看看
--------------------编程问答--------------------
引用 1 楼 kid_wang 的回复:
将二进制流读出来图片到指定的文件夹下,然后
利用函数
oWord.Selection.InlineShapes.AddPicture(ref name,ref LinkToFile,ref SaveWithDocument,ref Range);



C# code

object oMissing = System.Reflection.Missing.Value; 
obj……

为什么存放在数据库中的是二进制图片,不是路径 --------------------编程问答--------------------
引用 2 楼 xiaoqiu1234 的回复:
引用 1 楼 kid_wang 的回复:
将二进制流读出来图片到指定的文件夹下,然后
利用函数
oWord.Selection.InlineShapes.AddPicture(ref name,ref LinkToFile,ref SaveWithDocument,ref Range);



C# code

object oMissing = System.Reflectio……



+2 正解 --------------------编程问答-------------------- 如何将数据库中的图片和文字全部导入到word中 --------------------编程问答-------------------- 可以写详细一点吗
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,