0
FDK create CrossReference
New Here
,
/t5/framemaker-discussions/fdk-create-crossreference/td-p/1268372
Dec 17, 2008
Dec 17, 2008
Copy link to clipboard
Copied
Hello.
We want programatically create a new unstructured XREF to another structured document. We know Id and name and text of that element.
When we create a new XREF the target document is not opened anymore.
So FM creates reference but text is not set. So XREF is not visible, but using find we can find it in document (the text is WHITESPACE).
We need to open target document and call F_ApiUpdateXRefs and that text in that unstructured is updated and XREF is clickable.
Is there a way to create XRef to another document, even this document is not opened in time of creating such XREF?
We want programatically create a new unstructured XREF to another structured document. We know Id and name and text of that element.
When we create a new XREF the target document is not opened anymore.
So FM creates reference but text is not set. So XREF is not visible, but using find we can find it in document (the text is WHITESPACE).
We need to open target document and call F_ApiUpdateXRefs and that text in that unstructured is updated and XREF is clickable.
Is there a way to create XRef to another document, even this document is not opened in time of creating such XREF?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268373#M7391
Dec 17, 2008
Dec 17, 2008
Copy link to clipboard
Copied
Hanzel, I'm not sure, but I don't think so. I believe that the text displayed by an xref is off limits... only FrameMaker itself can get in there through an update.
I could be wrong.
Since you know the ID and text of the target, you could do a workaround like this:
- Programmtically open up some "dummy" or "scratchpad" file
- Create an identical target in that file
- In the same file, create an xref to that target
- Update the dummy file
- Copy the xref into your original document
- Reset the file pointer on the newly-copied xref (FP_XRefFile)
It's a bit more coding but it should work, if no one else suggests a better way.
Russ
I could be wrong.
Since you know the ID and text of the target, you could do a workaround like this:
- Programmtically open up some "dummy" or "scratchpad" file
- Create an identical target in that file
- In the same file, create an xref to that target
- Update the dummy file
- Copy the xref into your original document
- Reset the file pointer on the newly-copied xref (FP_XRefFile)
It's a bit more coding but it should work, if no one else suggests a better way.
Russ
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268374#M7392
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
Hi Hanzel,
I got curious and did some experimentation with this. I believe that my original suspicions were correct. I was able to retrieve a text location for an xref with the FP_TextRange property, but Frame would not let me add text in there, returning a FE_BadSelectionForOperation from F_ApiAddText(). So, I'll stick to my original workaround suggestion. Although it seems a bit convoluted, I don't think it would require too much code, maybe 20 lines or less.
Russ
I got curious and did some experimentation with this. I believe that my original suspicions were correct. I was able to retrieve a text location for an xref with the FP_TextRange property, but Frame would not let me add text in there, returning a FE_BadSelectionForOperation from F_ApiAddText(). So, I'll stick to my original workaround suggestion. Although it seems a bit convoluted, I don't think it would require too much code, maybe 20 lines or less.
Russ
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268375#M7393
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
It's been a while since I looked at this, but can't you set the
FP_XRefSrcText property of the FO_XRef object?
Ian
FP_XRefSrcText property of the FO_XRef object?
Ian
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268376#M7394
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
Hey Russ...
Did you try setting FP_Locked to False before editing the FP_XRefSrcText text? I'd swear that I did this at one point .. but I could be mistaken.
...scott
Did you try setting FP_Locked to False before editing the FP_XRefSrcText text? I'd swear that I did this at one point .. but I could be mistaken.
...scott
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268377#M7395
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
Hi Ian and Scott,
I hadn't noticed the FP_Locked property before, but it still didn't work when I set it to False. Here's what the FDK ref says about FP_Locked:
"True if the cross-reference is part of a text inset that retains formatting information from the source document. The cross-reference is not affected by global formatting performed on the document."
I'm not sure that is applicable to what we are talking about.
Also, I tried setting FP_XRefSrcText, but the text in the document view did not change. I remember trying that before but never having any success. The only way to get the text to update was through an FM update, which updates FP_XRefSrcText also. Which is what Hanzel wants to avoid.
Nonetheless, it may be that you have done it before and I just don't know how.
Russ
I hadn't noticed the FP_Locked property before, but it still didn't work when I set it to False. Here's what the FDK ref says about FP_Locked:
"True if the cross-reference is part of a text inset that retains formatting information from the source document. The cross-reference is not affected by global formatting performed on the document."
I'm not sure that is applicable to what we are talking about.
Also, I tried setting FP_XRefSrcText, but the text in the document view did not change. I remember trying that before but never having any success. The only way to get the text to update was through an FM update, which updates FP_XRefSrcText also. Which is what Hanzel wants to avoid.
Nonetheless, it may be that you have done it before and I just don't know how.
Russ
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Mentor
,
LATEST
/t5/framemaker-discussions/fdk-create-crossreference/m-p/1268378#M7396
Dec 18, 2008
Dec 18, 2008
Copy link to clipboard
Copied
Hanzel, by the way, if your first name is actually Peter, my apologies.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

