Bug 52972 - Enable RichText in SXSSF
Summary: Enable RichText in SXSSF
Status: RESOLVED CLOSED
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement with 8 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 53323 (view as bug list)
Depends on:
Blocks: 57294
  Show dependency tree
 
Reported: 2012-03-22 19:52 UTC by Jim Talbut
Modified: 2021-10-10 16:12 UTC (History)
3 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Talbut 2012-03-22 19:52:23 UTC
Currently RichText is lost (converted to normal text) in SXSSF.
Two ways to support this were suggested on the mailing list: either maintaining the RichText instances in memory (like styles) or streaming them via a separate file.
For my purposes I think in memory would be adequate, but a streaming solution that worked like SXSSF and kept the last n entries in memory would be tunable for different cases.
Comment 1 Marcin Piczkowski 2012-10-12 01:09:33 UTC
In addition to this issue RichText is also trimmed if there are leading or trailing spaces.
This issue is similar to Bug 48070. Probably it should be treated as separate issue.

I have localized the problem comes from:
org.apache.poi.xssf.streaming.SheetDataWriter
In metod 'writeCell' fragment:

            case Cell.CELL_TYPE_STRING: {
                _out.write(" t=\"inlineStr\">");
                _out.write("<is><t>");
                outputQuotedString(cell.getStringCellValue());
                _out.write("</t></is>");
                break;
            }
a check should be done if value contains leading/trailing spaces and then handled differently:

 _out.write("<is><t xml:space=\"preserve\">"); 
instead of:
 _out.write("<is><t>");
Comment 2 dirk.wilden 2012-10-12 08:37:48 UTC
it is also the same issue with leading/trailing linebreaks (\n).
They are trimmed as well.
Comment 3 Yegor Kozlov 2012-10-12 09:40:05 UTC
A very good catch, thanks!

Fixed in r1397499, junit aded.

Yegor

(In reply to comment #1)
> In addition to this issue RichText is also trimmed if there are leading or
> trailing spaces.
> This issue is similar to Bug 48070. Probably it should be treated as
> separate issue.
> 
> I have localized the problem comes from:
> org.apache.poi.xssf.streaming.SheetDataWriter
> In metod 'writeCell' fragment:
> 
>             case Cell.CELL_TYPE_STRING: {
>                 _out.write(" t=\"inlineStr\">");
>                 _out.write("<is><t>");
>                 outputQuotedString(cell.getStringCellValue());
>                 _out.write("</t></is>");
>                 break;
>             }
> a check should be done if value contains leading/trailing spaces and then
> handled differently:
> 
>  _out.write("<is><t xml:space=\"preserve\">"); 
> instead of:
>  _out.write("<is><t>");
Comment 4 Dominik Stadler 2015-03-23 21:00:35 UTC
*** Bug 53323 has been marked as a duplicate of this bug. ***
Comment 5 Dominik Stadler 2017-09-19 12:53:32 UTC
This is pretty much the same as bug 57294 where a possible implementation was suggested, but is now outdated...
Comment 6 PJ Fanning 2021-10-10 16:12:13 UTC
seems like a fix was applied