I’m trying to insert an image into a blank (.doc) document and I’m not succeeding in this. I’ve read a couple of topics about this in the forum but none of the solutions worked for me.
It seems there is a problem with .doc and images being inserted dynamically, but might be a workaround to do this.
So far I’ve tried with shape.WrapType being “None”, “Tight” or “Square”. Any help would be appreciate it.
Here there is the snippet of my code:
Document mDocument = new Document();
DocumentBuilder mDocumentBuilder = new DocumentBuilder( mDocument );
Aspose.Words.Drawing.Shape shape = mDocumentBuilder.InsertImage( @“Signatures\mySignature.bmp” );
shape.WrapType = Aspose.Words.Drawing.WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = Aspose.Words.Drawing.RelativeHorizontalPosition.Page;
shape.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Center;
shape.RelativeVerticalPosition = Aspose.Words.Drawing.RelativeVerticalPosition.Page;
shape.VerticalAlignment = Aspose.Words.Drawing.VerticalAlignment.Center;
SaveFormat mAsposeSaveFormat = SaveFormat.Doc;
string sFilePath = “myDirectory\myFile.doc”;
mDocument.Save( sFilePath, mAsposeSaveFormat);