int nextLength = value.length() - endLength;
Node nextNode = node.getNextSibling();
Node parNode = node.getParentNode();
// init text:a
TextAElement textLink = new TextAElement(
(OdfFileDom) node.getOwnerDocument());
Node newNode = null;
if (nextLength >= 0) {
textLink.setTextContent(value.substring(fromindex,
endLength));
newNode = node.cloneNode(true);
newNode.setNodeValue(value.substring(endLength, value.length()));
leftLength = 0;
} else {
textLink.setTextContent(value.substring(fromindex,
value.length()));
leftLength = endLength - value.length();
}
textLink.setXlinkTypeAttribute("simple");
textLink.setXlinkHrefAttribute(href);
if (nextNode != null) {
parNode.insertBefore(textLink, nextNode);
if (newNode != null) {
parNode.insertBefore(newNode, nextNode);