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 2010/11/11 23:53:45 UTC

DO NOT REPLY [Bug 50258] New: XSSFRichTextString corrupts Excel file when applyFont() is used

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

           Summary: XSSFRichTextString corrupts Excel file when
                    applyFont() is used
           Product: POI
           Version: 3.7
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: bugzilla@jabogo.de


Created an attachment (id=26284)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26284)
Corrupted Rich Text XLSX

Excel complains that the file created by the followin example is corrupted. Two
fonts are applied to the string "plain bold italic plain" and the space before
"bold" is removed. If you strip of the last five chars (" plain"), the file
opens without a warning but the space between "plain" and "bold" is still
missing.

The errors make the font aplying unusable for XSSF. The same test case with
HSSF works fine.

----------

import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class PoiRichTextBug
{
  public static void main(String[] args) throws Exception
  {
    Workbook workbook = new XSSFWorkbook();
    Sheet sheet = workbook.createSheet();
    Row row = sheet.createRow(0);
    Cell cell = row.createCell(0);
    RichTextString text =
workbook.getCreationHelper().createRichTextString("plain bold italic plain");
    Font font = workbook.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    text.applyFont(6, 10, font);
    font = workbook.createFont();
    font.setItalic(true);
    text.applyFont(11, 17, font);
    cell.setCellValue(text);
    workbook.write(new FileOutputStream("RichText.xlsx"));
  }
}

-- 
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 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

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

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

--- Comment #5 from Yegor Kozlov <ye...@dinom.ru> 2010-11-18 15:08:52 EST ---
Fixed in r1036599

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


DO NOT REPLY [Bug 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

JaBoGo <bu...@jabogo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26284|0                           |1
        is obsolete|                            |

--- Comment #2 from JaBoGo <bu...@jabogo.de> 2010-11-12 11:50:01 EST ---
Created an attachment (id=26291)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26291)
Corrupted file (generated by POI)

-- 
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 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

--- Comment #4 from JaBoGo <bu...@jabogo.de> 2010-11-12 11:52:39 EST ---
(In reply to comment #1)
> Could you please create the same document using excel? We can then compare the
> XML generated by POI, and the XML generated by excel, and hopefully spot what
> POI is doing wrong in your case.

The two new attachments describe the test case. Hope this helps.

-- 
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 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

JaBoGo <bu...@jabogo.de> changed:

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

-- 
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 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

--- Comment #3 from JaBoGo <bu...@jabogo.de> 2010-11-12 11:51:01 EST ---
Created an attachment (id=26292)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26292)
Valid file (generated by Excel 2010)

-- 
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 50258] XSSFRichTextString corrupts Excel file when applyFont() is used

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

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
         OS/Version|                            |All

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2010-11-12 06:02:28 EST ---
Could you please create the same document using excel? We can then compare the
XML generated by POI, and the XML generated by excel, and hopefully spot what
POI is doing wrong in your case.

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