It's all about the answers!

Ask a question

DNG - Cross reference link translation for RPE export

Sean F (1.2k12346) | asked Nov 14 '18, 2:55 a.m.

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?


Accepted answer

permanent link
Subramanya Prasad Pilar (4.1k14) | answered Nov 14 '18, 4:12 a.m.
edited Nov 14 '18, 8:02 a.m.
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)
  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

Sean F commented Nov 14 '18, 6:57 a.m.

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.

Subramanya Prasad Pilar commented Nov 14 '18, 8:02 a.m.

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

Subramanya Prasad Pilar commented Nov 21 '18, 2:18 a.m.

Were you able to get that working?

One other answer

permanent link
Sean F (1.2k12346) | answered Feb 18, 12:05 p.m.
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.

Your answer

Register or to post your answer.