XL.Format.SetFont
-----------------

Sets the font for the format.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [3.5](newinversion35.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Format.SetFont"; Book; Format; Value ) 

**MBS**( **"XL.Format.SetFont";** /\* Sets the font for the format. \*/  
**$Book**; /\* The reference number for the workbook.e.g. $ref \*/   
**$Format**; /\* The index of the format in the book to target.e.g. 0 \*/   
**$Value**) /\* The new font index. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Book | The reference number for the workbook. | $ref |
| Format | The index of the format in the book to target. | 0 |
| Value | The new font index. | $value |

### Result

Returns OK or error.

### Description

Sets the font for the format.   
You can use [XL.Book.AddFont](XLBookAddFont.md) to create a new font.  
### Examples

Create left aligned format with specific font:

 #create a font   
Set Variable \[$textFont ; Value:MBS ( "[XL.Book.AddFont](XLBookAddFont.md)"; $book )\]  
Set Variable \[$r ; Value:MBS ( "[XL.Font.SetSize](XLFontSetSize.md)"; $book ; $textfont ; 8)\]  
Set Variable \[$r ; Value:MBS ( "[XL.Font.SetName](XLFontSetName.md)"; $book ; $textfont ; "Century Gothic")\]  
\#create format   
Set Variable \[$textFormat ; Value:MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $book )\]  
Set Variable \[$r ; Value:MBS ( "XL.Format.SetFont"; $book ; $textFormat ; $textFont )\]  
Set Variable \[$r ; Value:MBS ( "[XL.Format.SetAlignH](XLFormatSetAlignH.md)"; $book ; $textFormat ; 1) // left\]  
### See also

- [XL.Format.GetFont](XLFormatGetFont.md)
- [XL.Format.GetIndent](XLFormatGetIndent.md)
- [XL.Format.GetWrap](XLFormatGetWrap.md)
- [XL.Format.SetAlignH](XLFormatSetAlignH.md)
- [XL.Format.SetBorder](XLFormatSetBorder.md)
- [XL.Format.SetIndent](XLFormatSetIndent.md)
- [XL.Format.SetWrap](XLFormatSetWrap.md)
- [XL.Sheet.CellWriteText](XLSheetCellWriteText.md)
- [XL.Sheet.CellWriteTexts](XLSheetCellWriteTexts.md)
- [XL.Sheet.SetCellFormats](XLSheetSetCellFormats.md)

### Example Databases

- [XL/Writing data](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/XL/Writing%20data.shtml#5ScriptAnchor_)
- [XL/XL Import and Export](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/XL/XL%20Import%20and%20Export.shtml#4ScriptAnchor_)

### Blog Entries

- [MBS Plugin Advent calendar: 13 - XL](https://www.mbsplugins.de/archive/2023-12-13/MBS_Plugin_Advent_calendar_13_/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2022, Seite 22](https://filemaker-magazin.de/neuigkeit/4196-Appetithappen-FMM_202205)

This function checks for a license.

Created 18th August 2014 , last changed 5th May 2016

  
[XL.Format.SetFillPattern](XLFormatSetFillPattern.md) - [XL.Format.SetHidden](XLFormatSetHidden.md)

[HTML Version](XLFormatSetFont.shtml)