Page 1 of 1

Form Field Extraction

PostPosted: Tue Dec 16, 2014 1:50 pm
by cyruswong
Hi,

I am using FieldRef to extract the MSWord docx form field data.
And, based on the code
https://github.com/plutext/docx4j/blob/ ... stics.java
Or by
https://github.com/plutext/docx4j/blob/ ... erger.java

OutputStream output = new OutputStream() {
private StringBuilder string = new StringBuilder();

@Override
public void write(int b) throws IOException {
this.string.append((char) b);
}

// Netbeans IDE automatically overrides this toString()
public String toString() {
return this.string.toString();
}
};

Writer out = new OutputStreamWriter(output);
try {
TextUtils.extractText(fr.getResultsSlot(), out);
out.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {

}
I can get the field name, and the first line of data in the text fields.

Do anyone know how to extract text field like?
Actually, I am able to do it in VBA, but no idea how to do it in JAVA.
http://gregmaxey.mvps.org/word_tip_page ... _data.html

Attached with the Sample word file and password abcd1234

Hope someone could give me some hits!
Thanks,
Cyrus