Enum FontFamily

FontFamily

הוצא משימוש. השיטות getFontFamily() ו-setFontFamily(String) משתמשות עכשיו בשמות מחרוזות של גופנים במקום ב-enum הזה. על אף שה-enum הזה הוצא משימוש, הוא ימשיך להיות זמין לצורך תאימות עם סקריפטים ישנים יותר.

המספור של הגופנים הנתמכים.

משתמשים בספירה FontFamily כדי להגדיר את הגופן לטווח של טקסט, רכיב או מסמך.

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);