Thanks Simon. I think we might need to treat this as user error. The factory 
used to create the XSSFFont is tied to a workbook instance so users should 
assume that object instances are tied to that workbook and can't be used for 
other workbooks.

Managing XSSFFonts and XSSFCellStyles is important because you don't want to 
add duplicate entries as it inflates the workbook size and can lead to errors 
but of course, you can hit errors like yours where the font or style doesn't 
get added at all.

Adding a safety net (that checks if the XSSFFont and XSSFCellStyle are tied to 
the same workbook) would be hard because XSSFFont does not have a reference to 
its workbook - and even if it might be possible to traverse to the CTWorkbook 
from the CTFont (that XSSFFont wraps), I'm not sure that it's worth the coding 
effort. And even if we put a safety net here, then the pressure would be add 
them in more places.

If any volunteers want to take on this effort then that would be great - any 
code contributions are always appreciated.






On Wednesday 10 November 2021, 13:04:16 GMT+1, Simon Baumeler 
<simon.baume...@ajila.com> wrote: 





Hello again

I found the problem that was causing the error for me.

If you're interested to see the solution: 
https://stackoverflow.com/questions/69854351/apache-poi-excel-styles-problem-when-creating-two-or-more-documents/69909918#69909918

Thanks the support and greetings

Simon

On 05.11.21, 22:44, "Simon Baumeler" <simon.baume...@ajila.com> wrote:

    Hello Andreas

    Thank you for your suggestions.

    I was on version 4.1.2 initially but i just changed to 5.0.0 and the issue 
remains the same.

    The files only have a size of 51 kb so I don’t know if that is what causes 
the problems.

    I will try to open the documents with other editors thank you for the tipp.

    Greets

    Simon 


    On 05.11.21, 17:02, "Andreas Reichel" <andr...@manticore-projects.com> 
wrote:

        Simon,

        please state which version of POI you are using.
        I have experiences similar challenges in the past, Pre 5.0.0 when
        writing large data > 4GByte zipped.

        No issue with 5.0.0 though (it has been fixed in this version).
        If you use only small files, then we could rule out this issue. 

        Also, maybe try to open the file in LibreOffice and/or Gnumeric so we
        have a change to know, if your challenge is Excel specific.

        Good luck and best regards
        Andreas


        On Fri, 2021-11-05 at 15:47 +0000, Simon Baumeler wrote:
        > Hello
        > 
        > I’ve encountered problems with apache poi:
        > 
        > https://stackoverflow.com/q/69854351/9273200
        > 
        > Thank you in advance for any tips and tricks or suggestions on how to
        > fix this issue.
        > 
        > Greetings
        > 
        > Simon




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to