#RPE-DNG_ Remove hyperlink from the DNG exported data
I am using RPE V2.1.2 and DNG v 6.0.6.1. I am exporting DNG module data using RPE. In DNG, embedded artifacts are linked to the content(description), which is getting exported in hyperlink form when I export the requirement details using query datasource/artifact/content/text/richTextbody/div and DNG text schema. I want the DNG export without hyperlink. my requirement is to remove hyperlink from the content when it is exported and apply some formatting(highlight embedded artifact).
Accepted answer
You can add a bookmark for every artifact that is linked to the content. You can either use a post processing macro or java script to change external hyperlinks into internal hyperlinks to the bookmarks.
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
You can also get this with simple java script substring and replace functions.