Google Slidesに配置した表内のフォントを変更したくて試したコードです。
I tried to change the font style of text in a table in Google Slides using the following Apps Script.
選択した表内のフォントをImpactへ変更します。
Change the font of the selected table to Impact.
Apps Script
Code.gs
function setTableCellFont() {
const presentation = SlidesApp.getActivePresentation();
const selection = presentation.getSelection();
const pageElement = selection.getPageElementRange().getPageElements()[0];
const table = pageElement.asTable();
const numRows = table.getNumRows();
const numColumns = table.getNumColumns();
for (let row = 0; row < numRows; row++) {
for (let col = 0; col < numColumns; col++) {
const cell = table.getCell(row, col);
const textRange = cell.getText();
const textStyle = textRange.getTextStyle();
textStyle.setFontFamily('Impact');
}
}
}
Reference
Class TextStyle > setFontFamily(fontFamily)