Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel has new default font Aptos, NPOI should not set a default FontName #1417

Open
desdoades opened this issue Sep 13, 2024 · 3 comments
Open

Comments

@desdoades
Copy link

Since last year Microsoft changed the default font of Excel (and other programs) to Aptos.

This means many users already have Aptos while others still have Calibri and some users might even have changed the default font to something else.

This rises the question why NPOI uses a DEFAULT_FONT_NAME constant (which is currently Calibri) at all. It can be found in XSSFFont.cs

As an example, HorizontalAlignment works perfectly fine the way I would expect it to work. When I dont set it for a CellStyle the Excel default is used.

So my request is to remove DEFAULT_FONT_NAME and if a Font has not set a FontName just use whatever Excel wants to show.

@tonyqus tonyqus added this to the NPOI 2.7.2 milestone Sep 13, 2024
@tonyqus
Copy link
Member

tonyqus commented Sep 13, 2024

It's hard for NPOI to detect what default font name should be used. NPOI only touch xls/xlsx. It doesn't know what version of Excel the user will use to open this Excel.

Since last year Microsoft changed the default font of Excel (and other programs) to Aptos.

Do you have document on this?

@desdoades
Copy link
Author

desdoades commented Sep 13, 2024

It's hard for NPOI to detect what default font name should be used. NPOI only touch xls/xlsx. It doesn't know what version of Excel the user will use to open this Excel.

I know. Thats why I suggest to not set a default font name at all and let Excel decide, just like with my example with HorizontalAlignment. Or is that technically impossible?

Do you have document on this?

Here and here for example.

This is how it looks in my Windows 11 Office 365 current Excel:
image

@tonyqus
Copy link
Member

tonyqus commented Sep 13, 2024

Leaving font not set can be a potential problem for any cells in the Excel. I'm not so sure because Excel client itself should make sure that there must be a default font set for any cell. If NPOI don't set, Excel may throw error or show this file is invalid.

@tonyqus tonyqus modified the milestones: NPOI 2.7.2, NPOI 2.7.3 Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants