@Test public void testCreateTextBox() throws IOException { String presentationId = this.createTestPresentation(); String pageId = this.createTestSlide(presentationId); BatchUpdatePresentationResponse response = this.snippets.createTextBoxWithText(presentationId, pageId); assertEquals(2, response.getReplies().size()); String boxId = response.getReplies().get(0).getCreateShape().getObjectId(); assertNotNull(boxId); }
public BatchUpdatePresentationResponse createTextBoxWithText( String presentationId, String slideId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); String textBoxId = "MyTextBox_01"; Dimension pt350 = new Dimension().setMagnitude(350.0).setUnit("PT"); requests.add(new Request() .setCreateShape(new CreateShapeRequest() .setObjectId(textBoxId) .setShapeType("TEXT_BOX") .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(pt350) .setWidth(pt350)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(350.0) .setTranslateY(100.0) .setUnit("PT"))))); requests.add(new Request() .setInsertText(new InsertTextRequest() .setObjectId(textBoxId) .setInsertionIndex(0) .setText("New Box Text Inserted"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape(); System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId()); return response; }
Snippets { public BatchUpdatePresentationResponse createTextBoxWithText( String presentationId, String slideId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); String textBoxId = "MyTextBox_01"; Dimension pt350 = new Dimension().setMagnitude(350.0).setUnit("PT"); requests.add(new Request() .setCreateShape(new CreateShapeRequest() .setObjectId(textBoxId) .setShapeType("TEXT_BOX") .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(pt350) .setWidth(pt350)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(350.0) .setTranslateY(100.0) .setUnit("PT"))))); requests.add(new Request() .setInsertText(new InsertTextRequest() .setObjectId(textBoxId) .setInsertionIndex(0) .setText("New Box Text Inserted"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape(); System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId()); return response; } }
Snippets { public BatchUpdatePresentationResponse createTextBoxWithText( String presentationId, String slideId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); String textBoxId = "MyTextBox_01"; Dimension pt350 = new Dimension().setMagnitude(350.0).setUnit("PT"); requests.add(new Request() .setCreateShape(new CreateShapeRequest() .setObjectId(textBoxId) .setShapeType("TEXT_BOX") .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(pt350) .setWidth(pt350)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(350.0) .setTranslateY(100.0) .setUnit("PT"))))); requests.add(new Request() .setInsertText(new InsertTextRequest() .setObjectId(textBoxId) .setInsertionIndex(0) .setText("New Box Text Inserted"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape(); System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId()); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); }
Snippets { public BatchUpdatePresentationResponse createTextBoxWithText( String presentationId, String slideId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); String textBoxId = "MyTextBox_01"; Dimension pt350 = new Dimension().setMagnitude(350.0).setUnit("PT"); requests.add(new Request() .setCreateShape(new CreateShapeRequest() .setObjectId(textBoxId) .setShapeType("TEXT_BOX") .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(pt350) .setWidth(pt350)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(350.0) .setTranslateY(100.0) .setUnit("PT"))))); requests.add(new Request() .setInsertText(new InsertTextRequest() .setObjectId(textBoxId) .setInsertionIndex(0) .setText("New Box Text Inserted"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape(); System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId()); 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 createTextBoxWithText( String presentationId, String slideId) throws IOException { Slides slidesService = this.service; List<Request> requests = new ArrayList<>(); String textBoxId = "MyTextBox_01"; Dimension pt350 = new Dimension().setMagnitude(350.0).setUnit("PT"); requests.add(new Request() .setCreateShape(new CreateShapeRequest() .setObjectId(textBoxId) .setShapeType("TEXT_BOX") .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(pt350) .setWidth(pt350)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(350.0) .setTranslateY(100.0) .setUnit("PT"))))); requests.add(new Request() .setInsertText(new InsertTextRequest() .setObjectId(textBoxId) .setInsertionIndex(0) .setText("New Box Text Inserted"))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateShapeResponse createShapeResponse = response.getReplies().get(0).getCreateShape(); System.out.println("Created textbox with ID: " + createShapeResponse.getObjectId()); 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);  }