Replace Header Text in Word

#1
I have a word document set up in a certain format. I want to replace a set of highlighted words in the header text using blueprism.
Using the action "replace highlighted text" doesn't work on the header. Are there any actions I could use to perform this without modifying the Word VBO?
 

ERC

New Member
#3
hello,

i have made a custom code for get highlighted text on word header. you can use this code to customize the replace highlighted text on header as well. hope this helps :)


Dim d As Object = GetDocument(handle,document_name)
Dim s As Object = Nothing
Dim f As Object = Nothing
Dim r As Object = Nothing
Dim i As Integer

Dim dt As New System.Data.DataTable()
Dim dr As System.Data.DataRow

Try
s = d.Sections(section)
f = s.Headers(header)
r = f.Range

dt.Columns.Add("text", GetType(String))
dt.Columns.Add("highlight index", GetType(Integer))

r.Find.Highlight = true
r.Find.Forward = True

Do While r.Find.Execute
If r.HighlightColorIndex <> 0 Then
dr = dt.NewRow()
dr("text") = r.Text
dr("highlight index") = r.HighlightColorIndex
dt.Rows.Add(dr)
End If
i = r.End
r.Start = i
Loop
highlighted_text = dt

Catch ex As Exception
Throw ex
Finally
d = Nothing
s = Nothing
f = Nothing
r = Nothing
End try
 
Top