Insert an multiple images into a document using Aspose.Words with Aspose.Barcode for Java

how will i attain this. i tried a lot of things but didnt seem to work. any help would be appreciated. thank you. :D


JButton btnCreate = new JButton("Create Barcode");
btnCreate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String strBaseFolder = "C:\\users\\ronjonathan\\desktop\\barcode\\";
String query = "Select MAX(ProductID) from tblindividualproduct";
try
{
// Generate barcode image
BarCodeBuilder builder = new BarCodeBuilder();
builder.setSymbologyType(Symbology.Code128);
pst=con.prepareStatement(query);
rs=pst.executeQuery();
if(rs.next()){
int MAX = rs.getInt(1);
for(int i = 1;i <= Integer.parseInt(txtBarcode.getText()); i++){
builder.setCodeText(Integer.toString(i+MAX));
String strBarCodeImageSave = +(i+MAX)+".jpg";
builder.save(strBaseFolder + strBarCodeImageSave);
// Add the image to a Word doc
Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.insertImage(strBaseFolder + strBarCodeImageSave);
String strWordFile = "doc.doc";
doc.save(strBaseFolder + strWordFile);
}
JOptionPane.showMessageDialog(null, "Success!");
}
}catch(Exception e){
e.printStackTrace();
}
}
});

Hi there,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.


  • Please attach your barcode images.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach your target Word document showing the desired behavior. You can use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

As soon as you get these pieces of information to us we’ll start our investigation into your issue.