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 2014/12/02 11:45:08 UTC

[Bug 57294] New: RichText is converted to nomal text in SXSSF

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

            Bug ID: 57294
           Summary: RichText is converted to nomal text in SXSSF
           Product: POI
           Version: 3.10-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: SXSSF
          Assignee: dev@poi.apache.org
          Reporter: y-konishi@tsrweb.co.jp

I have used SXSSF to output Excel files (xlsx).
When I tried to write RichTextString in SXSSFCell, it was converted to normal
text in output file,
(just reflected one cell style to whole cell),
because it seems that SheetDataWriter.java does not support RichTextString.

Then, I tried to change method SheetDataWriter#writeCell according to the rules
of OOXML, 
and it worked well in my environment.

Here is my code:
-----------------------------------------
SheetDataWriter.java

public void writeCell(int columnIndex, Cell, cell) throws IOException {
    int celltype = cell.getCellType();
    switch(celltype){
    case Cell.CELL_TYPE_STRING:
        // get RichTextString info
        XSSFRichTextString richText = (XSSFRichTextString)
cell.getRichStringCellValue();
        List<CTRElt> listElt = richText.getCTRst().getRList();

        // write cell info to sheet.xml
        String ref = new CellReferec(this._rownum,
columnIndex).formatAsString();
        this._output.write("<c r=\"" + ref + "\"");
        CellStyle cellStyle = cell.getCellStyle();
        if(cellStyle.getIndex() != 0) {
            this._output.write(" s=\"" + cellStyle.getIndex() + "\"");
        }  

        this._output.write(" t=\"inlineStr\">");
        this._output.write("<is>");

        for(int i = 0; i < listElt.size(); i++) {
            CTRElt elt = listElt.get(i);
            if(elt.isSetRPr()) {
                // the case of having font styles
                this._output.write("<r>");
                this._output.write("<rPr>");
                // write rpr infomation, which CTRElt has (*)
                this._output.write("</rPr>");
                this._output.write("<t");
                if(hasLeadingTrailingSpaces(elt.getT())) {
                    this._output.write(" xml:space=\"preserve\"");
                }
                this._output.write(">");
                outputQuotedString(elt.getT());
                this._output.write("</t>");
                this._output.write("</r>");
            }
        }

        this._output.write("</is>");
        this._output.write("</c>");

    }
}


(Sorry, some parts(*) are ommitted.)
-----------------------------------------

Is there any problems in my code?
If possible, I hope it would be reflected in next version.

Thanks,

-- 
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


[Bug 57294] RichText is converted to nomal text in SXSSF

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

Dominik Stadler <do...@gmx.at> changed:

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

-- 
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


[Bug 57294] RichText is converted to nomal text in SXSSF

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

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
I tried to work on this, but there was support for SharedStringTables added via
bug 53130, which is breaking your suggested implementation.

Any chance you can come up with an up-to-date patch here? Preferably in
patch-format, see http://poi.apache.org/guidelines.html#SubmittingPatches for
how this can be done.

-- 
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


Re: [Bug 57294] New: RichText is converted to nomal text in SXSSF

Posted by gagan <ga...@gmail.com>.
Hello

I was just wondering how you can write your custom SheetDataWriter.java ?

As its invocation is tightly coupled with the SXSSFSheet.

Please let me know how I can inject my custom SheetDataWriter for handling
the RichTextString



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Bug-57294-New-RichText-is-converted-to-nomal-text-in-SXSSF-tp5717281p5725133.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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