Create CTHyperlink
Posted: Sun Apr 02, 2023 9:47 pm
I'm using org.docx4j 8.3.9 and java 11.
Trying to create a Hyperlink to the website on one of my slides.
Code example:
Text t = new Text();
t.setValue(text);
CTRegularTextRun rText = new CTRegularTextRun();
rText.setT(t.getValue());
CTTextCharacterProperties rProps = new CTTextCharacterProperties();
rText.setRPr(rProps);
ObjectFactory dmlFactory = new ObjectFactory();
CTHyperlink hyperlink = dmlFactory.createCTHyperlink();
hyperlink.setAction("https://dev.ccc.com/");
hyperlink.setTgtFrame("_blank");
rProps.setHlinkClick(hyperlink);
after opening pptx file, I cannot see the possibility of clicking on this hyperlink. if I use internal linking inside the presentation, it's working.
Also, if I use HTTP instead of HTTPS it throws an exception on opening pptx file with the message "PowerPoint found a problem with content".
Any ideas?
Trying to create a Hyperlink to the website on one of my slides.
Code example:
Text t = new Text();
t.setValue(text);
CTRegularTextRun rText = new CTRegularTextRun();
rText.setT(t.getValue());
CTTextCharacterProperties rProps = new CTTextCharacterProperties();
rText.setRPr(rProps);
ObjectFactory dmlFactory = new ObjectFactory();
CTHyperlink hyperlink = dmlFactory.createCTHyperlink();
hyperlink.setAction("https://dev.ccc.com/");
hyperlink.setTgtFrame("_blank");
rProps.setHlinkClick(hyperlink);
after opening pptx file, I cannot see the possibility of clicking on this hyperlink. if I use internal linking inside the presentation, it's working.
Also, if I use HTTP instead of HTTPS it throws an exception on opening pptx file with the message "PowerPoint found a problem with content".
Any ideas?