SpreadsheetML Font - Calibri vs Calibri (Body)

Dordrecht

New Member
Joined
May 18, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi All

I'm creating Excel documents using what I understand to be SpreadsheetML. The XML syntax allows the specification of font using the following syntax:
<Style ss:ID="s200"> <Alignment ss:Vertical="Bottom"/> <Borders> <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/> <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/> <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> </Borders> <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000" ss:Bold="1"/> <Interior ss:Color="#FFFF00" ss:Pattern="Solid"/> </Style>

My problem is that our client has specified that they want the spreadsheet to be in Calibri (Body) font. How can I specify that in this code? ss:FontName="Calibri (Body)" doesn't work. Some research I did on the web indicated that the "(Body)" part isn't even part of the actual fint name, but is somethign added by Excel.

Any help would be appreciated.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Alex Blakenburg

Well-known Member
Joined
Feb 23, 2021
Messages
1,737
Office Version
  1. 365
Platform
  1. Windows
I don't know for sure but you could try this.
The Body and Heading fonts are tied to themes.
When I recorded selecting the Calibri Font Theme (PageLayout > Themes > Fonts > Calibri), I got this
VBA Code:
    ActiveWorkbook.Theme.ThemeFontScheme.Load ( _
        "C:\Program Files\Microsoft Office\root\Document Themes 16\Theme Fonts\Calibri.xml"

If then instead of specifying Calibri you apply the style eg for Normal you get Calibri body, the heading styles will give you Calibri heading
VBA Code:
Selection.Style = "Normal"

By using the styles if you switch the Font Theme to say Arial, all the fonts will change with the theme.
 

Dordrecht

New Member
Joined
May 18, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Thank you, Alex, but in SpreadsheetML, "Normal" is specified as a default font, and it uses the same syntax for its specification as custom fonts. Too bad there's not a way to write VBA into a speradsheet using SpreadsheetML... or maybe there is?
 

Alex Blakenburg

Well-known Member
Joined
Feb 23, 2021
Messages
1,737
Office Version
  1. 365
Platform
  1. Windows
Sorry I have not been able to find out any more about this.
 

Forum statistics

Threads
1,141,605
Messages
5,707,355
Members
421,503
Latest member
Rickys03

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top