https://bz.apache.org/bugzilla/show_bug.cgi?id=64098
Bug ID: 64098 Summary: Whitespace in text not preserved if starting with tab character Product: POI Version: unspecified Hardware: PC Status: NEW Severity: normal Priority: P2 Component: XWPF Assignee: dev@poi.apache.org Reporter: gjmath...@gmail.com Target Milestone: --- Leading/trailing whitespace is preserved only if leading or trailing character is a whitespace but fails to preserve if that chararter is a tab (\t). Tab characters get stripped in the generated Word document. Here's a patch to XWPFRun.java in org.apache.poi.xwpf.usermodel package from poi-ooxml-4.1.1.jar. *** XWPFRun.java --- XWPFRun.java.orig *************** *** 146,152 **** */ static void preserveSpaces(XmlString xs) { String text = xs.getStringValue(); ! if (text != null && text.length() >= 1 && (Character.isWhitespace(text.charAt(0)) ! || Character.isWhitespace(text.charAt(text.length()-1))) { XmlCursor c = xs.newCursor(); c.toNextToken(); --- 146,152 ---- */ static void preserveSpaces(XmlString xs) { String text = xs.getStringValue(); ! if (text != null && (text.startsWith(" ") || text.endsWith(" "))) { XmlCursor c = xs.newCursor(); c.toNextToken(); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org