添加引用
using Aspose.Words;
using Aspose.Words.Drawing;using Aspose.Words.Rendering;
Document doc = new Document(TempValue);//TempValue doc模板的路径
DocumentBuilder builder = new DocumentBuilder(doc);Shape shape = new Shape(doc,ShapeType.Image);
shape.ImageData.SetImage(Server.MapPath("Images/test.jpg"));
shape.Width = 70;//设置宽和高
shape.Height = 70;shape.WrapType = WrapType.None;
shape.BehindText = true;//shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
//shape.HorizontalAlignment = HorizontalAlignment.Center; //shape.RelativeVerticalPosition = RelativeVerticalPosition.Page; //shape.VerticalAlignment = VerticalAlignment.Center; //shape.HorizontalAlignment = HorizontalAlignment.Center;builder.MoveToBookmark("PO_MyImage");
builder.InsertNode(shape);doc.Save("newword.doc",SaveFormat.Doc);