Bookmarks do not work with 'mixed' references

I want to make custom links to tables that I create in Word for certain model elements. Since the automatic Word caption generation does not work with M2Doc, I wanted to use a workaround by using Bookmarks and BookmarkRefs to create my own captions.

However, I’m facing the problem that I either have to use fully custom references or pure capella values, I cannot use a mix. Below are two examples that work

Custom reference example:

{m:'start'.asBookmark('start')}

Link to the {m:'beginning'.asBookmarkRef('start')}

Capella value example (with LF being a logicalFunction element):

{m:(LF.name).asBookmark(LF.id)}

Link to {m:(LF.name).asBookmarkRef(LF.id)}

What does NOT work is the following:

{m:(LF.name).asBookmark( (LF.id+'_ref') )}

Link to {m:(LF.name).asBookmarkRef( (LF.id+'_ref') )}

If I do this, a link will be created but it just sends me to the beginning of the document. I checked the created reference IDs and they look how they should look.
What makes it extra confusing is, that when I use the Word cross-reference function I can create working links to the bookmarks that look identical but behave differently (see picture below).

image

Can you try without the underscore ? Also there was some bugs on the bookmarks and bookmarks references in the past so you might want to upgrade to M2Doc 3.2.0 if you are not already using version 3.2.0.

Yes, I already use M2Doc 3.2.0.

But removing the underscore did the trick!
So using LF.id+'ref' works, while LF.id+'_ref' does not.

Thank you!

I made another interesting observation. Could it be that there is a length limit on word bookmarks? Because if I add any string with length greater than 3 to the LF.id (length > 39 characters) the link does not work anymore.

That’s possible… I’m not sure where I could find the bookmark reference specifications.