[Bug 64098] New: Whitespace in text not preserved if starting with tab character

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 64098] New: Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
           Keywords|                            |PatchAvailable

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

--- Comment #1 from PJ Fanning <[hidden email]> ---
Do you have an input file that demonstrates the problem? Or a unit test? It
would be useful for us to have a regression test so that we don't accidentally
undo this change later.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

--- Comment #2 from [hidden email] ---
Created attachment 36981
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36981&action=edit
Junit test that fails

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

--- Comment #3 from [hidden email] ---
Created attachment 36982
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36982&action=edit
build.gradle file to run testcase

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

J. Mathews <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |4.1.1-FINAL

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64098] Whitespace in text not preserved if starting with tab character

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64098

PJ Fanning <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from PJ Fanning <[hidden email]> ---
applied with https://svn.apache.org/repos/asf/poi/trunk@1873188

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]