I can’t manage to insert a purely linked image form scratch. It looks like it always ends up in an embedded image. I use some code like
Aspose.Words.Document doc = new Aspose.Words.Document();
Aspose.Words.Drawing.Shape newShape = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.Image);
newShape.ImageData.SourceFullName = @"C:\myImage.gif";
doc.LastSection.Body.LastParagraph.AppendChild(newShape);
doc.save("file.doc");
According to the documentation the image should then be a linked image but I can see no field in the saved doc. Instead the image is embedded.
What went wrong?
Hi
Thanks for your inquiry. You can insert linked image into the document using InsertField method. Linked imaged is INCLUDEPICTURE field. Please see the following code:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
string fieldCode = string.Format("INCLUDEPICTURE \"{0}\" \\d", @"C:\\Temp\\1.jpg");
builder.InsertField(fieldCode, null);
doc.Save(@"Test067\out.doc");
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.