Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary


Google Slidesの表内の指定文字を太字にしたい - Bold specific text within a table in Google Slides

In the following link, all the text within the cell was bolded without specifying any particular text.

In this example, I tried to use code to bold specified text within a specific cell of the currently selected table.

今回の例では、セルの中に含まれる 「Google」 というテキストを太字にします。
In this example, the text " Google" contained within a cell is replaced with an empty string.

The text containing the words to be bolded this time

Trying to use Google Apps Script to bold a specific value within a targeted cell in a table in Google Slides.

Manually, you can click the "B" icon at the top to make the text bold.

You can select multiple text elements by holding down the ⌘ (Command) key while selecting.

Apps Script
function boldSelectedText() {
const value = "Google";
const table = getSelectedTable();
const row = 1;
const col = 1;
const cell = table.getCell(row, col);

const textRange = cell.getText();
const text = textRange.asString();
const indices = [];
let startIndex = text.indexOf(value);
while (startIndex !== -1) {
startIndex = text.indexOf(value, startIndex + value.length);

for (let i = 0; i < indices.length; i++) {
const startIndex = indices[i];
const endIndex = startIndex + value.length;
const textStyle = textRange.getRange(startIndex, endIndex).getTextStyle();

今回の例では、スライドに3行2列の表を用意して、2行目2列のセルに「 Google Apps Script」と「 Google Slides」というテキストを含めておきます。
In this example, I prepare a 3-row, 2-column table on the slide and include the text "Google Apps Script" and "Google Slides" in the cell at row 2, column 2.

After selecting the table and run replaceValue() in, the text "Google" will be bolded.


Class TextStyle > setBold(bold) 

Google Slidesの表内の文字を太字にしたい - Bold the text in a table in Google Slides

Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...