You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/10/27 20:51:23 UTC

DO NOT REPLY [Bug 48070] New: Preserving leading and trailing spaces XSSFCell

https://issues.apache.org/bugzilla/show_bug.cgi?id=48070

           Summary: Preserving leading and trailing spaces XSSFCell
           Product: POI
           Version: 3.5-FINAL
          Platform: All
        OS/Version: Windows Vista
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: dmonti@linoma.com


I would like to have a string value in a cell that maintains the leading and
trailing spaces. If I set a String value in a cell with leading and trailing
spaces, the value seems to be preserved in the XML, but does not display in
Excel.
For example:
XSSFCell cell = row.createCell(0);
cell.setCellValue("   XYZ   ");

Yields <si><t>   XYZ   </t></si> in sharedStrings.xml but does not display the
spaces in Excel.

If you just type the value in Excel you get
<si><t xml:space="preserve">    XYZ    </t></si> 

POI should have some way of preserving these spaces.

Thanks

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 48070] Preserving leading and trailing spaces XSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48070

Yegor Kozlov <ye...@dinom.ru> changed:

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

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2009-10-28 03:44:12 UTC ---
Fixed in r830492

The fix looks easy on the surface but it took quite a while to understand how
to do it with XmlBeans. xml:space="preserve" belongs to the Official XML
Namespace  (http://www.w3.org/XML/1998/namespace) and XmlBeans does not
generate get/set accessors to it. It turned out that the only way to set this
attribute is via XmlCursor, see the patch.

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org