Enum FontFamily

字型系列

已淘汰。getFontFamily()setFontFamily(String) 方法現在使用字型字串名稱,而非這個列舉。雖然這個列舉已淘汰,但仍可用於與舊版指令碼的相容性。

列舉支援的字型。

使用 FontFamily 列舉,為文字、元素或文件的特定範圍設定字型。

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