We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extracting text from word file using Java


Can you please help me in extracting the text from a word file?

For example, if I have

Illustration reference:

as a line in Doc file.

I want to extract ILLUSTRATION_REF from the line & put it into a List.

Let me know if it is possible using Aspose.Word.

If Yes then please send me the example code.



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can do that using Replace method and ReplaceEvaluator. I already provided you such method. Please see the following link:

You should use ReplaceEvaluator like the following:

public class ReplaceTagsEvaluator implements ReplaceEvaluator


public int replace(Object sender, ReplaceEvaluatorArgs e) throws Exception


//Get matched values

String fieldName = e.getMatch().group(1);

String fieldFormat = e.getMatch().group(3);

//Here you can put values into the list instead of printing they out.



return ReplaceAction.SKIP;



Hope this helps.

Best regards.


Thanks for your help.

I was just wondering if we you had some other method (Direct Api method)

Anyways thanks for the quick reply.