Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

FDK create CrossReference

New Here ,
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?

Views

594
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 18, 2008 Dec 18, 2008

Copy link to clipboard

Copied

LATEST
Hanzel, by the way, if your first name is actually Peter, my apologies.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines