Bug 51262 - Wrong font pointed by formatting run (custom style)
Summary: Wrong font pointed by formatting run (custom style)
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-FINAL
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 03:19 UTC by Philippe Vosges
Modified: 2017-10-09 19:36 UTC (History)
0 users



Attachments
example of the bug (24.50 KB, application/vnd.ms-excel)
2011-05-25 03:19 UTC, Philippe Vosges
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Vosges 2011-05-25 03:19:36 UTC
Created attachment 27056 [details]
example of the bug

In the attached file, there are two cells containing the same text "abcxyz", seemingly formatted the same way: "abc" takes the default font (MS P Gothic) but in bold and "xyz" is normal (not bold) but bigger (11pt).

The first cell is copied from an actual work document, I have been working with. It contains the problem.

The second cell is a reproduction of the format made directly in this XLS file with Excel 2007.

While they show the same way in Excel, POI reads something different in both cells. The formatting run (corresponding to "xyz") of the first cell references the wrong font (font index 0). Everything is fine in the second cell (the formatting run points to font 29, which is different from the cell font).

Might be that it comes from some BIFF8 archaism, unsupported by POI (I don't know the whole history of the original file but it could be an old one, copied again and again).

Also reproduced with 3.8-beta2-20110408.
Comment 1 Yegor Kozlov 2011-06-18 08:34:20 UTC
I can see that the problematic cell B3 is formatted using a custom user-defined style (標準_NEV) and the default font for this style is MS P Gothic 10pt bold.

POI doesn't take this into account and returns you the global default font which is 11pt regular. 

Something to improve in future.

Yegor
Comment 2 Philippe Vosges 2011-06-20 01:08:29 UTC
Thanks for looking into this. I didn't notice there was a custom style. Now I wonder if this is not a duplicate of some other entry (couldn't find it though).
Comment 3 Dominik Stadler 2017-10-09 19:36:14 UTC
Works for me now, see unit-test added via r1811595.