Hyperlinks

From NOA Documentation Wiki

Jump to: navigation, search

Source: http://ubion.ion.ag/mainForumFolder/noa_forum/0102?b_start:int=0#0002

This snippet will add a link "Heise" with the URL http://www.heise.de in the last row of a table and export the document as HTML:

ITextTable table = textDocument.getTextTableService().getTextTables()[0];
IText text = table.getCell("A1";).getTextService().getText();
XText xText = text.getXText();
XTextCursor xTextCursor = xText.createTextCursor();
xText.insertString(xTextCursor, "Heise", true);
XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
xPropertySet.setPropertyValue("HyperLinkURL","http://www.heise.de";);
document.getPersistenceService().export(outputPfadHtml, HTMLFilter.FILTER);
Personal tools