I need to copy a RichTextDocLink from one document to another while keeping the integrity of the link back to the original (a third) document. Is this even possible? I have been trying all the methods I can think of and haven’t seen a question like this posted. Thanks in advance.
I have resoved this problem The link did in fact come through with a CopyAllItems.
Subject: RE: Copy RichtextDoclink from one doc to another
You could say a little more – all right, a lot more – about what approaches you’ve tried and why they have been unsatisfactory, what language you’re working in, what else is in the rich text, etc. You haven’t mentioned what language you’re using, but since you’ve used the Java class name (almost) I’ll assume it’s Java.
As you’ve probably noticed, there’s no class method to copy the doclink to another rich text item. This leaves you three choices.
First, you could use appendRTItem method to copy over the doclink along with everything else in the field. Depending what else is in the field (and how sure you are of that) you might be able to delete the other data, e.g. by using RichTextRange.remove.
Second, you could use the properties of the RichTextDoclink class to locate the linked-to document and recreate the link. This fails if the ID running the code doesn’t have access to the linked document. However, note that all the relevant properties of RichTextItem are read-write, so you could create a link to any document, then go back and insert the information linking to the real target document.
Third, you could construct your output using DXL which you then import. Since you could also DXL-export the original document to get the exact representation of the doclink, this would let you just copy over the relevant nodes using a DOM parser (or string functions, but hey…).