Enum FontFamily

Font Family

Deprecated.The methods get Font Family() and set Font Family(String) now use string names for fonts instead of this enum. Although this enum is deprecated, it will remain available for compatibility with older scripts.

An enumeration of the supported fonts.

Use the Font Family enumeration to set the font for a range of text, element or document.

 const 
  
 body 
  
 = 
  
 DocumentApp 
 . 
 getActiveDocument 
 (). 
 getActiveTab 
 (). 
 asDocumentTab 
 (). 
 getBody 
 (); 
 // Insert a paragraph at the start of the document. 
 body 
 . 
 insertParagraph 
 ( 
 0 
 , 
  
 'Hello, Apps Script!' 
 ); 
 // Set the tab font to Calibri. 
 body 
 . 
 editAsText 
 (). 
 setFontFamily 
 ( 
 DocumentApp 
 . 
 FontFamily 
 . 
 CALIBRI 
 ); 
 // Set the first paragraph font to Arial. 
 body 
 . 
 getParagraphs 
 ()[ 
 0 
 ]. 
 setFontFamily 
 ( 
 DocumentApp 
 . 
 FontFamily 
 . 
 ARIAL 
 ); 
 // Set "Apps Script" to Comic Sans MS. 
 const 
  
 text 
  
 = 
  
 'Apps Script' 
 ; 
 const 
  
 a 
  
 = 
  
 body 
 . 
 getText 
 (). 
 indexOf 
 ( 
 text 
 ); 
 const 
  
 b 
  
 = 
  
 a 
  
 + 
  
 text 
 . 
 length 
  
 - 
  
 1 
 ; 
 body 
 . 
 editAsText 
 (). 
 setFontFamily 
 ( 
 a 
 , 
  
 b 
 , 
  
 DocumentApp 
 . 
 FontFamily 
 . 
 COMIC_SANS_MS 
 ); 
Create a Mobile Website
View Site in Mobile | Classic
Share by: