Page 1 of 1

How To remove REFS

PostPosted: Sun May 31, 2020 2:32 pm
by emreozen
Hi,
I am using the library for reading Word Docs. I do the following to get the text out:
Code: Select all
    static String getParagraphText(Object obj) {
        if (!(obj instanceof P)) { /
            return "";
        }
        try {
            P paragraph = (P) obj;
            wordStringWriter.getBuffer().setLength(0);
            TextUtils.extractText(paragraph, wordStringWriter);
        } catch (Exception exception) {
            return "";
        }


however I always get stuff like
".....REF _Ref472256234 \w \h \* MERGEFORMAT ...."
in the text. I thought of regex replacing them, but is there a smarter and more reliable way to do this?

Thanks in advance!