Headings And Body Theme Font

Headings And Body Theme Font In Excel

In Excel, select Home tab, click on the font dropdown box ,you will see “Theme Fonts” with two theme fonts : Calibri Light (Headings) and Calibri (Body) on the top with English region setting.

Theme Fonts

If Theme Font is selected, the font name will display different in different regions . If you do not want that the font is automitally changed in different regions, don’t select the two Theme Fonts .

Changing Headings And Body Font Programally

With Aspose.Cells for Python via .NET , we can check whether the default font is theme font or set theme font with Font.scheme_type property.

The following sample code shows how to manipulate theme font.

from aspose.cells import FontSchemeType, Workbook
workbook = Workbook("Book1.xlsx")
defaultStyle = workbook.default_style
schemeType = defaultStyle.font.scheme_type
if schemeType == FontSchemeType.MAJOR or schemeType == FontSchemeType.MINOR:
print("It's theme font")
# Change theme font to mormal font
defaultStyle.font.scheme_type = FontSchemeType.NONE
workbook.default_style = defaultStyle

Dynamically Gets Local Theme Font Programally

Sometimes, our servers and users' machines are not in the same region. How can we obtain the same font that users want for file processing?

We have to set the system regional settings before loading the file with LoadOptions.region property

The following sample code shows how to get local theme font.

from aspose.cells import CountryCode, LoadOptions, Workbook
# Instantiate a new LoadOptions.
options = LoadOptions()
# Sets the customer's region
options.region = CountryCode.JAPAN
# Instantiate a new Workbook.
workbook = Workbook("Book1.xlsx", options)
defaultStyle = workbook.default_style
# Gets customer's local font.
localFontName = defaultStyle.font.name