It's all about the answers!

Ask a question

#RPE-DNG_ Remove hyperlink from the DNG exported data


Anjuri Kelaiya (3732) | asked Oct 30 '19, 1:52 a.m.

 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). 

I have gone though some online documentation(https://rpeactual.com/2013/01/18/processing-rich-text-in-rpe/) but it is not helping. 
Please suggest me how can I achieve this?
Thanks!

Accepted answer


permanent link
Subramanya Prasad Pilar (4.6k16) | answered Oct 30 '19, 2:10 p.m.

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.

Anjuri Kelaiya selected this answer as the correct answer

Comments
Anjuri Kelaiya commented Nov 01 '19, 3:08 a.m.

Hello Subramanya


I added macro as mentioned above and it is working as expected.
Many thanks for your help.
 

Your answer


Register or 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.