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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|REMIND                      |




--- Comment #13 from Yegor Kozlov <ye...@dinom.ru>  2009-02-27 06:25:13 PST ---
Is there anything special in the way you create / set rich text strings? Can
you post the code you used to generated the attached files? 

Compare two code snippets:

        HSSFRichTextString str1 = new HSSFRichTextString("Andritz AG, Graz
Short Name: AAG");
        str1.applyFont(0, 16, FONT_CELL_HEADER_BLUE.getIndex());
        str1.applyFont(17, 29, FONT_ITALIC.getIndex());
        str1.applyFont(29, 32, FONT.getIndex());
        cell.setCellValue(str1);


        HSSFRichTextString str2 = new HSSFRichTextString("Andritz AG, Graz
Short Name: AAG");
        cell2.setCellValue(str2);
        str2.applyFont(0, 16, FONT_CELL_HEADER_BLUE.getIndex());
        str2.applyFont(17, 29, FONT_ITALIC.getIndex());
        str2.applyFont(29, 32, FONT.getIndex());

They are not equivalent. The second one is incorrect and can produce wrong
results. Once a HSSFRichTextString  is assigned, it is supposed to be
immutable. I would say in the latter case the code should throw
IllegalStateException. We don't do that only because of backwards
compatibility. 

One of the problems with beta5fileMissingFonts.xls is that the internal cache
of strings is incorrect. There are duplicate entries and as result,
beta5fileMissingFonts.xls is 504 KB while beta3fileAllFonts.xls is just 331 KB. 
Internally, Excel stores all strings in a shared string table which is shared
across workbook. Text cells just contain indexes into the string table as the
value of a cell, instead of the full string. If the string cache is broken, it
is very likely to be the reason why some fonts are missing. 

Regards,
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-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to