使用Application.Selection.InlineShapes.AddPicture(filePath,false,true,Missing.Value)

解决方案 »

  1.   

    protected void getPhoto(string personId,ref PTSWord.Range range)
    {
    object LinkToFile = false,SaveWithDocument = true;
    object Range = System.Reflection.Missing.Value;
    PTSWord.InlineShape inLineShape;
    String fileName = String.Empty;
    fileName = PhotoPath + "\\" + personId + ".jpg";
    try
    {
    range.Text = "";
    inLineShape = range.InlineShapes.AddPicture(fileName,ref LinkToFile,ref SaveWithDocument,ref Range);
    inLineShape.Width = 80;
    inLineShape.Height = 103;

    }
    catch(Exception e)
    {
    Console.WriteLine(e.Message);
    this.IsExit = true;
    }
    return ;
    }