This example inserts a hyperlink at the second paragraph.
try { Application application = Application.getInstance(); Documents documents = application.getDocuments(); Document document = documents.openDocument("D:\\document.ott", true); Selection selection = document.getSelection(); TextRange range = document.getParagraphs().item(2).getRange(); selection.setRange(range.getStart(), range.getEnd()); selection.insertHyperLink("This is a hyper link...", "http://www.sina.com.cn"); } catch(Exception e) { e.printStackTrace(); }
Related information