#region 在WORD表格插入图片
private void AddPicture(Word.Document wdc,System.Data.DataRow myRow)
{
object missing = System.Reflection.Missing.Value;
string strTemp = Application.StartupPath+"//temp.gif";
byte[] MyData= new byte[0];
try
{
if(myRow["picture1"]!=null)
MyData = (byte[])myRow["picture1"];
else
return;
int ArraySize = new int();
ArraySize = MyData.GetUpperBound(0);
System.IO.FileStream fs = new System.IO.FileStream(strTemp, FileMode.OpenOrCreate, FileAccess.Write);
try
{
fs.Write(MyData, 0,ArraySize);
fs.Close();
}
catch(System.Exception e1)
{
rhtxtError.Text += "["+currContent+"]"+"WORD表格插入图片: "+e1.Message+"/n";
}
finally
{
fs = null;
MyData = null;
}
Thread.Sleep(500);
wdc.Application.Selection.InlineShapes.AddPicture(strTemp,ref missing,ref missing,ref missing);
}
catch
{
}
}
#endregion