diff options
author | Alain Béarez <abearez@apache.org> | 2020-03-29 22:21:35 +0000 |
---|---|---|
committer | Alain Béarez <abearez@apache.org> | 2020-03-29 22:21:35 +0000 |
commit | ce544b85503b695eff0ceb96d67e239962bcb06c (patch) | |
tree | a97911ac757e4eb94d16b90ed2acdb168d5d7df8 /src/examples | |
parent | 3cb1a38d8e79429574e331985a32c5b98dbf62ab (diff) | |
download | poi-ce544b85503b695eff0ceb96d67e239962bcb06c.tar.gz poi-ce544b85503b695eff0ceb96d67e239962bcb06c.zip |
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
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java | 6 |
1 files changed, 6 insertions, 0 deletions
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); |