Skip to content

Commit 231d5b0

Browse files
committed
Update slides region tags
1 parent 6304924 commit 231d5b0

1 file changed

Lines changed: 24 additions & 25 deletions

File tree

slides/snippets/src/main/java/Snippets.java

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,31 @@ public class Snippets {
2626

2727
public String createPresentation(String title) throws IOException {
2828
Slides slidesService = this.service;
29-
// [START createPresentation]
29+
// [START slides_create_presentation]
3030
Presentation presentation = new Presentation()
3131
.setTitle(title);
3232
presentation = slidesService.presentations().create(presentation)
3333
.setFields("presentationId")
3434
.execute();
3535
System.out.println("Created presentation with ID: " + presentation.getPresentationId());
36-
// [END createPresentation]
36+
// [END slides_create_presentation]
3737
return presentation.getPresentationId();
3838
}
3939

4040
public String copyPresentation(String presentationId, String copyTitle) throws IOException {
4141
Drive driveService = this.driveService;
42-
// [START copyPresentation]
42+
// [START slides_copy_presentation]
4343
File copyMetadata = new File().setName(copyTitle);
4444
File presentationCopyFile =
4545
driveService.files().copy(presentationId, copyMetadata).execute();
4646
String presentationCopyId = presentationCopyFile.getId();
47-
// [END copyPresentation]
47+
// [END slides_copy_presentation]
4848
return presentationCopyId;
4949
}
5050

5151
public BatchUpdatePresentationResponse createSlide(String presentationId) throws IOException {
5252
Slides slidesService = this.service;
53-
// [START createSlide]
53+
// [START slides_create_slide]
5454
// Add a slide at index 1 using the predefined "TITLE_AND_TWO_COLUMNS" layout
5555
// and the ID "MyNewSlide_001".
5656
List<Request> requests = new ArrayList<>();
@@ -72,14 +72,14 @@ public BatchUpdatePresentationResponse createSlide(String presentationId) throws
7272
slidesService.presentations().batchUpdate(presentationId, body).execute();
7373
CreateSlideResponse createSlideResponse = response.getReplies().get(0).getCreateSlide();
7474
System.out.println("Created slide with ID: " + createSlideResponse.getObjectId());
75-
// [END createSlide]
75+
// [END slides_create_slide]
7676
return response;
7777
}
7878

7979
public BatchUpdatePresentationResponse createTextBoxWithText(
8080
String presentationId, String slideId) throws IOException {
8181
Slides slidesService = this.service;
82-
// [START createTextBoxWithText]
82+
// [START slides_create_textbox_with_text]
8383
// Create a new square text box, using a supplied object ID.
8484
List<Request> requests = new ArrayList<>();
8585
String textBoxId = "MyTextBox_01";
@@ -114,7 +114,7 @@ public BatchUpdatePresentationResponse createTextBoxWithText(
114114
slidesService.presentations().batchUpdate(presentationId, body).execute();
115115
CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape();
116116
System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId());
117-
// [END createTextBoxWithText]
117+
// [END slides_create_textbox_with_text]
118118
return response;
119119
}
120120

@@ -127,7 +127,7 @@ public BatchUpdatePresentationResponse createImage(String presentationId,
127127
throws IOException {
128128
Slides slidesService = this.service;
129129
Drive driveService = this.driveService;
130-
// [START createImage]
130+
// [START slides_create_image]
131131
// Temporarily upload a local image file to Drive, in order to to obtain a URL
132132
// for the image. Alternatively, you can provide the Slides service a URL of
133133
// an already hosted image.
@@ -173,7 +173,7 @@ public BatchUpdatePresentationResponse createImage(String presentationId,
173173

174174
// Remove the temporary image file from Drive.
175175
driveService.files().delete(fileId).execute();
176-
// [END createImage]
176+
// [END slides_create_image]
177177
return response;
178178
}
179179

@@ -183,7 +183,7 @@ public List<BatchUpdatePresentationResponse> textMerging(
183183
Drive driveService = this.driveService;
184184
Sheets sheetsService = this.sheetsService;
185185
List<BatchUpdatePresentationResponse> responses = new ArrayList<>(5);
186-
// [START textMerging]
186+
// [START slides_text_merging]
187187
// Use the Sheets API to load data, one record per row.
188188
String dataRangeNotation = "Customers!A2:M6";
189189
ValueRange sheetsResponse = sheetsService.spreadsheets().values()
@@ -242,7 +242,7 @@ public List<BatchUpdatePresentationResponse> textMerging(
242242
customerName + " with ID: " + presentationId);
243243
System.out.println("Replaced " + numReplacements + " text instances.");
244244
}
245-
// [END textMerging]
245+
// [END slides_text_merging]
246246
return responses;
247247
}
248248

@@ -254,7 +254,7 @@ public BatchUpdatePresentationResponse imageMerging(String templatePresentationI
254254
String logoUrl = imageUrl;
255255
String customerGraphicUrl = imageUrl;
256256

257-
// [START imageMerging]
257+
// [START slides_image_merging]
258258
// Duplicate the template presentation using the Drive API.
259259
String copyTitle = customerName + " presentation";
260260
File content = new File().setName(copyTitle);
@@ -293,14 +293,14 @@ public BatchUpdatePresentationResponse imageMerging(String templatePresentationI
293293

294294
System.out.println("Created merged presentation with ID: " + presentationId);
295295
System.out.println("Replaced " + numReplacements + " shapes instances with images.");
296-
// [END imageMerging]
296+
// [END slides_image_merging]
297297
return response;
298298
}
299299

300300
public BatchUpdatePresentationResponse simpleTextReplace(
301301
String presentationId, String shapeId, String replacementText) throws IOException {
302302
Slides slidesService = this.service;
303-
// [START simpleTextReplace]
303+
// [START slides_simple_text_replace]
304304
// Remove existing text in the shape, then insert the new text.
305305
List<Request> requests = new ArrayList<>();
306306
requests.add(new Request()
@@ -321,14 +321,14 @@ public BatchUpdatePresentationResponse simpleTextReplace(
321321
slidesService.presentations().batchUpdate(presentationId, body).execute();
322322

323323
System.out.println("Replaced text in shape with ID: " + shapeId);
324-
// [END simpleTextReplace]
324+
// [END slides_simple_text_replace]
325325
return response;
326326
}
327327

328328
public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId)
329329
throws IOException {
330330
Slides slidesService = this.service;
331-
// [START textStyleUpdate]
331+
// [START slides_text_style_update]
332332
// Update the text style so that the first 5 characters are bolded
333333
// and italicized, and the next 5 are displayed in blue 14 pt Times
334334
// New Roman font, and the next five are hyperlinked.
@@ -382,14 +382,14 @@ public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, St
382382
slidesService.presentations().batchUpdate(presentationId, body).execute();
383383

384384
System.out.println("Updated text style for shape with ID: " + shapeId);
385-
// [END textStyleUpdate]
385+
// [END slides_text_style_update]
386386
return response;
387387
}
388388

389389
public BatchUpdatePresentationResponse createBulletedText(String presentationId,
390390
String shapeId) throws IOException {
391391
Slides slidesService = this.service;
392-
// [START createBulletedText]
392+
// [START slides_create_bulleted_text]
393393
// Add arrow-diamond-disc bullets to all text in the shape.
394394
List<Request> requests = new ArrayList<>();
395395
requests.add(new Request()
@@ -405,15 +405,15 @@ public BatchUpdatePresentationResponse createBulletedText(String presentationId,
405405
BatchUpdatePresentationResponse response =
406406
slidesService.presentations().batchUpdate(presentationId, body).execute();
407407
System.out.println("Added bullets to text in shape with ID: " + shapeId);
408-
// [END createBulletedText]
408+
// [END slides_create_bulleted_text]
409409
return response;
410410
}
411411

412412
public BatchUpdatePresentationResponse createSheetsChart(
413413
String presentationId, String pageId, String spreadsheetId, Integer sheetChartId)
414414
throws IOException {
415415
Slides slidesService = this.service;
416-
// [START createSheetsChart]
416+
// [START slides_create_sheets_chart]
417417
// Embed a Sheets chart (indicated by the spreadsheetId and sheetChartId) onto
418418
// a page in the presentation. Setting the linking mode as "LINKED" allows the
419419
// chart to be refreshed if the Sheets version is updated.
@@ -444,14 +444,14 @@ public BatchUpdatePresentationResponse createSheetsChart(
444444
BatchUpdatePresentationResponse response =
445445
slidesService.presentations().batchUpdate(presentationId, body).execute();
446446
System.out.println("Added a linked Sheets chart with ID " + presentationChartId);
447-
// [END createSheetsChart]
447+
// [END slides_create_sheets_chart]
448448
return response;
449449
}
450450

451451
public BatchUpdatePresentationResponse refreshSheetsChart(
452452
String presentationId, String presentationChartId) throws IOException {
453453
Slides slidesService = this.service;
454-
// [START refreshSheetsChart]
454+
// [START slides_refresh_sheets_chart]
455455
List<Request> requests = new ArrayList<>();
456456

457457
// Refresh an existing linked Sheets chart embedded a presentation.
@@ -465,8 +465,7 @@ public BatchUpdatePresentationResponse refreshSheetsChart(
465465
BatchUpdatePresentationResponse response =
466466
slidesService.presentations().batchUpdate(presentationId, body).execute();
467467
System.out.println("Refreshed a linked Sheets chart with ID " + presentationChartId);
468-
// [END refreshSheetsChart]
468+
// [END slides_refresh_sheets_chart]
469469
return response;
470470
}
471-
472471
}

0 commit comments

Comments
 (0)