Dim m As Map = CreateMap("HEADER": "asdasd")
Dim doc As JavaObject = OpenDocx("C:\Users\H\Downloads\TEST1.docx", "")
Dim AllParagrpahs As List
AllParagrpahs.Initialize
Dim headers As List = doc.RunMethod("getHeaderList", Null)
For Each header As JavaObject In headers
AllParagrpahs.AddAll(header.RunMethod("getParagraphs", Null))
Next
AllParagrpahs.AddAll(doc.RunMethod("getParagraphs", Null))
For Each p As JavaObject In AllParagrpahs
Dim runs As List = p.RunMethod("getRuns", Null)
If runs.IsInitialized Then
For Each r As JavaObject In runs
Dim text As String = r.RunMethod("getText", Array(0))
If text <> Null Then
For Each key As String In m.Keys
If text.Contains("$"&key&"$") Then
r.RunMethod("setText", Array(""&m.Get(key)&"", 0))
End If
Next
End If
Next
End If
Next
SaveDocument(doc, "C:\Users\H\Downloads\TEST2.docx", "")