Re: font problem or wrong usage
Nick Burch <[email protected]> Fri, 9 Sep 2022 13:46:26 +0100 (BST)
| Newsgroups | gmane.comp.jakarta.poi.user |
|---|---|
| Message-ID | <[email protected]> |
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