Appending hyperlink into Docx file using docx4j library
Download docx4j library. filepath = valid path to .docx file url = hyperlink to append into end of the file public boolean appendUrlDocx() { try { File inputFile = new File(filepath); WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(inputFile); // Create hyperlink P.Hyperlink link = createHyperlink(wordMLPackage, url); // Add it to a paragraph org.docx4j.wml.ObjectFactory wmlFactory = new org.docx4j.wml.ObjectFactory(); org.docx4j.wml.P paragraph = wmlFactory.createP(); paragraph.getParagraphContent().add(link); wordMLPackage.getMainDocumentPart().addObject(paragraph); // Now save it wordMLPackage.save(inputFile); return true; } catch (InvalidFormatException ex) { ex.printStackTrace(); return false; } catch (Exception ex) { ex.printStackTr