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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]