我想使用Novacode Docx替换word文档中的图像,但我只知道通过此代码插入
var gDoc = DocX.Load(@"MauPhieuNhapCBCC.docx");
using (MemoryStream ms = new MemoryStream())
{
System.Drawing.Image myImg = System.Drawing.Image.FromFile(@"img.jpg");
myImg.Save(ms, myImg.RawFormat); // Save your picture in a memory stream.
ms.Seek(0, SeekOrigin.Begin);
Image img = gDoc.AddImage(ms); // Create image.
Picture pic1 = img.CreatePicture();
// Create picture.
var abc = gDoc.Paragraphs.FirstOrDefault(g => g.Pictures.Count > 0);
abc.Alignment = Alignment.right;
abc.InsertPicture(pic1,29).Position(0.3); // Insert picture into paragraph.
}
gDoc.SaveAs("Exported.docx");
我怎样才能更换或插入特殊位置?