From ce544b85503b695eff0ceb96d67e239962bcb06c Mon Sep 17 00:00:00 2001 From: Alain BĂ©arez Date: Sun, 29 Mar 2020 22:21:35 +0000 Subject: allow add and remove a HyperlinkRun or a FieldRun git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875862 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/examples') diff --git a/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java b/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java index 9de12c5aa4..2699015445 100644 --- a/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java +++ b/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java @@ -27,6 +27,7 @@ import org.apache.poi.xwpf.usermodel.TextAlignment; import org.apache.poi.xwpf.usermodel.UnderlinePatterns; import org.apache.poi.xwpf.usermodel.VerticalAlign; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; @@ -78,6 +79,11 @@ public class SimpleDocument { r3.setFontSize(20); r3.setSubscript(VerticalAlign.SUPERSCRIPT); + // hyperlink + XWPFHyperlinkRun hyperlink = p2.insertNewHyperlinkRun(0, "http://poi.apache.org/"); + hyperlink.setUnderline(UnderlinePatterns.SINGLE); + hyperlink.setColor("0000ff"); + hyperlink.setText("Apache POI"); XWPFParagraph p3 = doc.createParagraph(); p3.setWordWrapped(true); -- cgit v1.2.3