This class (StyleCreator) where I hold all styles, are created per workbook. 
And all styles are in this StyleCreator class initialized only once.


Peter Bušfy

Digital Service consultant


ITERA

Make a difference
---------------------
itera.com <http://www.itera.com>



________________________________
From: Nick Burch <[email protected]>
Sent: Friday, September 9, 2022 2:46 PM
To: Peter Busfy <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: font problem or wrong usage

On Fri, 9 Sep 2022, Peter Busfy wrote:
> I started using POI recently. And I ran to one interesting issue with
> fonts. I have one dedicated class where I store all styles which I use
> in my project. Here in this class, I also hold font. So far, I just need
> only one font in whole project. So, I initialized this one font, only
> once, and stored it as a class variable. And then I used this font in
> all style's initializations.

Are you caching the styles too? Styles are per-workbook.

> Surprisingly it stared causes quite unpredictable behavior. In some
> sheets it works with any problems, but in some other issues occurred.

If you're creating a fresh style every time, you're probably just running
out of styles and Excel is ignoring all the ones past its max.

Re-use styles across cells and sheets and you won't run out, then Excel
will pay attention to all of them

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to