Free Support Forum - aspose.com

How To Show Image By Aspose.Word

I have a template doc file with an image , when i genereate doc file using that template then the image

is removed and i get a doc file with all needed data except that image

is there any special way to show an image with Aspose.World

Normally that should not happen. Please tell me what version of Aspose.Words you are currently using. also please attach the document template, code snippet used to process the template and the resulting document. We need all these to be able to reproduce and eventually fix the error.

Best regards,

public Document execute() throws Exception
{
//Open the template document
Document doc = new Document("E:\\Aspose\\Aspose.Words\\demos\\Documents\\DinnerInvitationDemo.doc");

//Example of a very simple mail merge to populate fields only once from an array of values.
doc.getMailMerge().execute(
new String[] {"MyName", "MyTitle", "MyAddress1", "MyAddress2"},
new Object[] {"James Bond", "Secret Agent", "MI5 Headquarters", "Milbank, London"});

//Mail merge customer details from DataTable to the document.
//Whole document content will be repeated for each record.
//ResultSet customers = executeDataTable("SELECT TOP 5 * FROM AsposeWordCustomers WHERE Country = 'USA'");
//doc.getMailMerge().execute(customers);

return doc;
}

public static void main(String args[]) {

DinnerInvitationDemo d = new DinnerInvitationDemo();
try {

Document dd = d.execute();
dd.save("C:\\DinnerInvitationDemo1.doc");
} catch(Exception e) { }
}

i am usong the demo version

the template is a simple doc file having an image

So you are using Aspose.Words for Java. Please make sure that your project uses 2.0 or later version of the library, because support for graphics and images in Word documents is implemented only starting from this version.

Best regards,