@Test public void testTextStyleUpdate() throws IOException { String presentationId = this.createTestPresentation(); String pageId = this.createTestSlide(presentationId); String boxId = this.createTestTextBox(presentationId, pageId); BatchUpdatePresentationResponse response = this.snippets.textStyleUpdate(presentationId, boxId); assertEquals(3, response.getReplies().size()); }
public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(0) .setEndIndex(5)) .setStyle(new TextStyle() .setBold(true) .setItalic(true)) .setFields("bold,italic"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(5) .setEndIndex(10)) .setStyle(new TextStyle() .setFontFamily("Times New Roman") .setFontSize(new Dimension() .setMagnitude(14.0) .setUnit("PT")) .setForegroundColor(new OptionalColor() .setOpaqueColor(new OpaqueColor() .setRgbColor(new RgbColor() .setBlue(1.0F) .setGreen(0.0F) .setRed(0.0F))))) .setFields("foregroundColor,fontFamily,fontSize"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(10) .setEndIndex(15)) .setStyle(new TextStyle() .setLink(new Link() .setUrl("www.example.com"))) .setFields("link"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); System.out.println("Updated text style for shape with ID: " + shapeId); return response; }
Snippets { public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(0) .setEndIndex(5)) .setStyle(new TextStyle() .setBold(true) .setItalic(true)) .setFields("bold,italic"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(5) .setEndIndex(10)) .setStyle(new TextStyle() .setFontFamily("Times New Roman") .setFontSize(new Dimension() .setMagnitude(14.0) .setUnit("PT")) .setForegroundColor(new OptionalColor() .setOpaqueColor(new OpaqueColor() .setRgbColor(new RgbColor() .setBlue(1.0F) .setGreen(0.0F) .setRed(0.0F))))) .setFields("foregroundColor,fontFamily,fontSize"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(10) .setEndIndex(15)) .setStyle(new TextStyle() .setLink(new Link() .setUrl("www.example.com"))) .setFields("link"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); System.out.println("Updated text style for shape with ID: " + shapeId); return response; } }
Snippets { public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(0) .setEndIndex(5)) .setStyle(new TextStyle() .setBold(true) .setItalic(true)) .setFields("bold,italic"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(5) .setEndIndex(10)) .setStyle(new TextStyle() .setFontFamily("Times New Roman") .setFontSize(new Dimension() .setMagnitude(14.0) .setUnit("PT")) .setForegroundColor(new OptionalColor() .setOpaqueColor(new OpaqueColor() .setRgbColor(new RgbColor() .setBlue(1.0F) .setGreen(0.0F) .setRed(0.0F))))) .setFields("foregroundColor,fontFamily,fontSize"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(10) .setEndIndex(15)) .setStyle(new TextStyle() .setLink(new Link() .setUrl("www.example.com"))) .setFields("link"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); System.out.println("Updated text style for shape with ID: " + shapeId); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); }
Snippets { public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(0) .setEndIndex(5)) .setStyle(new TextStyle() .setBold(true) .setItalic(true)) .setFields("bold,italic"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(5) .setEndIndex(10)) .setStyle(new TextStyle() .setFontFamily("Times New Roman") .setFontSize(new Dimension() .setMagnitude(14.0) .setUnit("PT")) .setForegroundColor(new OptionalColor() .setOpaqueColor(new OpaqueColor() .setRgbColor(new RgbColor() .setBlue(1.0F) .setGreen(0.0F) .setRed(0.0F))))) .setFields("foregroundColor,fontFamily,fontSize"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(10) .setEndIndex(15)) .setStyle(new TextStyle() .setLink(new Link() .setUrl("www.example.com"))) .setFields("link"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); System.out.println("Updated text style for shape with ID: " + shapeId); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); String createPresentation(String title); String copyPresentation(String presentationId, String copyTitle); BatchUpdatePresentationResponse createSlide(String presentationId); BatchUpdatePresentationResponse createTextBoxWithText(
            String presentationId, String slideId); BatchUpdatePresentationResponse createImage(String presentationId,
                                                       String slideId,
                                                       GoogleCredential credential); List<BatchUpdatePresentationResponse> textMerging(
            String templatePresentationId, String dataSpreadsheetId); BatchUpdatePresentationResponse imageMerging(String templatePresentationId,
                                                        String imageUrl,
                                                        String customerName); BatchUpdatePresentationResponse simpleTextReplace(
            String presentationId, String shapeId, String replacementText); BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId); BatchUpdatePresentationResponse createBulletedText(String presentationId,
                                                              String shapeId); BatchUpdatePresentationResponse createSheetsChart(
            String presentationId, String pageId, String spreadsheetId, Integer sheetChartId); BatchUpdatePresentationResponse refreshSheetsChart(
            String presentationId, String presentationChartId); }
Snippets { public BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(0) .setEndIndex(5)) .setStyle(new TextStyle() .setBold(true) .setItalic(true)) .setFields("bold,italic"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(5) .setEndIndex(10)) .setStyle(new TextStyle() .setFontFamily("Times New Roman") .setFontSize(new Dimension() .setMagnitude(14.0) .setUnit("PT")) .setForegroundColor(new OptionalColor() .setOpaqueColor(new OpaqueColor() .setRgbColor(new RgbColor() .setBlue(1.0F) .setGreen(0.0F) .setRed(0.0F))))) .setFields("foregroundColor,fontFamily,fontSize"))); requests.add(new Request() .setUpdateTextStyle(new UpdateTextStyleRequest() .setObjectId(shapeId) .setTextRange(new Range() .setType("FIXED_RANGE") .setStartIndex(10) .setEndIndex(15)) .setStyle(new TextStyle() .setLink(new Link() .setUrl("www.example.com"))) .setFields("link"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); System.out.println("Updated text style for shape with ID: " + shapeId); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); String createPresentation(String title); String copyPresentation(String presentationId, String copyTitle); BatchUpdatePresentationResponse createSlide(String presentationId); BatchUpdatePresentationResponse createTextBoxWithText(
            String presentationId, String slideId); BatchUpdatePresentationResponse createImage(String presentationId,
                                                       String slideId,
                                                       GoogleCredential credential); List<BatchUpdatePresentationResponse> textMerging(
            String templatePresentationId, String dataSpreadsheetId); BatchUpdatePresentationResponse imageMerging(String templatePresentationId,
                                                        String imageUrl,
                                                        String customerName); BatchUpdatePresentationResponse simpleTextReplace(
            String presentationId, String shapeId, String replacementText); BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId); BatchUpdatePresentationResponse createBulletedText(String presentationId,
                                                              String shapeId); BatchUpdatePresentationResponse createSheetsChart(
            String presentationId, String pageId, String spreadsheetId, Integer sheetChartId); BatchUpdatePresentationResponse refreshSheetsChart(
            String presentationId, String presentationChartId);  }