Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

DNG - Cross reference link translation for RPE export

We can do cross reference links in DNG from a word in artifactA to a heading artifactB using edit artifactA->select word->add link->no traceability link to the heading artifactB in another part of the module.

When we export that module to Word using RPE the cross reference hyperlink appears in the Word document but it is a hyperlink back to the ArtifactB in the DNG database.

We want the cross reference to be translated into a Word cross reference to the heading representing artifactB in the exported word doc.

Is this possible?

606

0 votes


Accepted answer

Permanent link
You can use a post processing macro that processes external hyperlinks and turn them into internal hyperlinks to bookmarks (to heading artifacts). First, you can add bookmarks for Headings so that on clicking the cross reference link, you will be taken to the heading artifact.

Sub processHyperlinks()
'Processes external hyperlinks to RRC and turns them into internal Word hyperlinks to bookmarks with the
'address I<requirement artifact item id>

Dim oHyperLink As Hyperlink

For Each oHyperLink In ActiveDocument.Hyperlinks
'   MsgBox ("Subaddress=" & ActiveDocument.Hyperlinks(counter).SubAddress & "Address=" & ActiveDocument.Hyperlinks(counter).address & "Name=" & ActiveDocument.Hyperlinks(counter).name & "TextToDisplay=" & ActiveDocument.Hyperlinks(counter).TextToDisplay)
  oHyperLink.Range.Select
 
  Dim address As String
  address = oHyperLink.address
 
  Dim index As Integer
  index = InStr(address, "/resources/")
 
  If index > 0 And address <> oHyperLink.TextToDisplay Then
     Dim name As String
     name = "I" + Right(address, Len(address) - index - 10)
    
     Dim display As String
     display = oHyperLink.TextToDisplay
    
     If display <> "" Then ActiveDocument.Hyperlinks.Add Anchor:=oHyperLink.Range, SubAddress:=name, TextToDisplay:=display
  End If

Next oHyperLink

End Sub
Fariz Saracevic selected this answer as the correct answer

2 votes

Comments
Thanks

Does this macro already exist?

I would have a go myself but I am not sure how a post-processing macro could translate a DNG URL into a an internal bookmark hyperlink.

As I couldn't add it as comment, modified the answer.

Were you able to get that working?


One other answer

Permanent link
Thank you Prasad for the detailed answer and the example macro

Sorry I did not follow up at the time you responded.

I look forward to trying out the suggested solution.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: Nov 14 '18, 2:55 a.m.

Question was seen: 2,524 times

Last updated: Feb 18 '21, 12:05 p.m.

Confirmation Cancel Confirm