poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Clarkson <Derek.Clark...@lonelyplanet.com.au>
Subject Fonts question and possible bug
Date Mon, 11 Apr 2005 05:51:48 GMT

Hello everyone,
	I have been working on some code to format cell fonts to a
spreadsheet module I have and I have struck something that looks odd. If I

HSSFFont font = wb.createFont();
font.setFontHeightInPoints( (short) 20);
HSSFFont font2 = wb.findFont(font.getBoldweight(), font.getColor(),
	font.getFontHeight(), font.getFontName(),
	font.getItalic(), font.getStrikeout(),
	font.getTypeOffset(), font.getUnderline());

Then the findFont() method returns a null where it should return the
original font I created (unless I'm missing something!). Looking inside the
POI code I see that the findFont method code automatically skips index 4 of
the font array. I then dumped out the fonts from a fresh spreadsheet and
found that there are 4 in total, all indentical. When I then added an
additional font as per above, the code added two font entries at index 4 and
5. Both of which have a font size of 20, but then fails to find either. 

If I then add a further font it adds (as I would have thought correctly) an
additional single entry and it correctly finds a matching font.

Is there a reason why font Index 4 is skipped and why 2 fonts are added ?
Why is my font not found by the findFont() method when I have just added it

I'm looking at the source code and wondering why is is working this way.

Derek Clarkson
Global Applications
Lonely Planet Publications
ph: (03) 8379-8000
Direct: (03) 8379-8100-8401
"It's not a bug - it's an undocumented feature!"

This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright.  If you
have received this email in error, please advise the sender and delete
it.  If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone.  You must not copy or 
communicate to others content that is confidential or subject to 
copyright, unless you have the consent of the content owner.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message