Google Apps Script

Enum FontFamily

An enumeration of the supported fonts.

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

 
var body = DocumentApp.getActiveDocument().getBody();

 // Insert a paragraph at the start of the document.
 body.insertParagraph(0, "Hello, Apps Script!");

 // Set the document 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.
 var text = 'Apps Script';
 var a = body.getText().indexOf(text);
 var b = a + text.length - 1;
 body.editAsText().setFontFamily(a, b, DocumentApp.FontFamily.COMIC_SANS_MS);
 

Properties

PropertyTypeDescription
AMARANTHEnumThe Amaranth font family.
ARIALEnumThe Arial font family.
ARIAL_BLACKEnumThe Arial Black font family.
ARIAL_NARROWEnumThe Arial Narrow font family.
ARVOEnumThe Arvo font family.
CALIBRIEnumThe Calibri font family.
CAMBRIAEnumThe Cambria font family.
COMIC_SANS_MSEnumThe Comic Sans MS font family.
CONSOLASEnumThe Consolas font family.
CORSIVAEnumThe Corsiva font family.
COURIER_NEWEnumThe Courier New font family.
DANCING_SCRIPTEnumThe Dancing Script font family.
DROID_SANSEnumThe Droid Sans font family.
DROID_SERIFEnumThe Droid Serif font family.
GARAMONDEnumThe Garamond font family.
GEORGIAEnumThe Georgia font family.
LOBSTEREnumThe Lobster font family.
MERRIWEATHEREnumThe Merriweather font family.
PHILOSOPHEREnumThe Philosopher font family.
QUATTROCENTOEnumThe Quattrocento font family.
SYNCOPATEEnumThe Syncopate font family.
TAHOMAEnumThe Tahoma font family.
TIMES_NEW_ROMANEnumThe Times New Roman font family.
TREBUCHET_MSEnumThe Trebuchet MS font family.
UBUNTUEnumThe Ubuntu font family.
VERDANAEnumThe Verdana font family.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.