Document Builder insert field invoking the URL

Hi _ I am using Aspose.Net to change some document properties and insert a field
DocumentBuilder bldr - new DocumentBuilder()
bldr.Document = doc //where doc is the document we are working with

bldr.InsertField(string.format("INCLUDEPICTURE \ "someURL.gig""));

some URL actually update the database and we are hoping to invoke it when someone opens the doc. BUT as the line to insertfields is executing the url is getting invoked.

Would like to know why this might be happening? and if there is a way to not invokde the url when the field is inserted?

Hi Bikrant,

Thanks for your inquiry. Could you please share some more detail about your query what exact you want to achieve using Aspose.Words? We will then provide you more information about your query along with code.

If you do not want to update field after inserting the field in the document, please use following code example. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
FieldIncludePicture field = (FieldIncludePicture)builder.InsertField(FieldType.FieldIncludePicture, false);
field.SourceFullName = "http://www.aspose.com/images/aspose-logo.gif";
doc.Save(MyDir + "Out.docx");

Hi Tahir - We are trying another option to actually achieve the same results as in the post.

https://forum.aspose.com/t/37174

Let me try out your code changes and see if that solves our issue.

Hi Tahir - That is giving us the same behavior as i have mentioned in initial query.

so what we are trying to achieve is that we are trying to insert a transparent gif to a document when it is getting uploaded and when someone tries to open the doc we want to invoke that image url and save some information.

We do not want the document image link to fire when we are inserting it in the document but only when user opens the document.

if i set the updatefield to false in the FieldIncludePicture the document is not requesting for the gif when it is opened. By using an Alternate way i.e instead of inserting a field using IncludePicture I have tried inserting a shape node.

Shape sh = new Shape(ShapeType.Image)
sh.sourceFullName = "someurl.gif"

builder.InsertNode(shape)

in this scenario the builder.InsertNode is not invoking the url (as we need it) and only requesting it when we open the document.

The same behavior we are trying tp achieve using FieldIncludePicture but are not able to do so coz builder.InserField actually invokes the url ???

Hi Bikrant,

Thanks for sharing the detail. You need to update the field (FieldIncludePicture) to invoke the image link. We have already answered your query here related to your requirements. Please follow that thread for further proceedings.