Hi
Thanks for your request. Maybe the following code could help you to achieve what you need:
//This is our dictionary that contains known words
Dictionary dict = new Hashtable();
dict.put("UNIVERSIDADE", "This is new value");
dict.put("CNICA", "This is new value");
dict.put("nomes", "This is new value");
//Open document
Document doc = new Document("C:\\Temp\\half.doc");
//Get document range
Range reprange = doc.getRange(); //.replace(regex, new MyReplaceEvaluator(), true);
//compile pattern
Pattern regex = Pattern.compile("[\\wзЗаАбБйЙнНуУъЪгГвф-]+");
//create matcher
Matcher match = regex.matcher(doc.toTxt());
int i = 0;
while (match.find())
{
//Replace nwon word with ints value in the document
if (dict.get(match.group()) != null)
reprange.replace(match.group(), (String)dict.get(match.group()), true, true);
}
doc.save("C:\\Temp\\out.doc");
Best regards.
Alexey Noskov
Developer/Technical Support
Aspose Auckland Team