Google Slides
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
새 프레젠테이션을 만듭니다.
function createPresentation() {
var presentation =
Slides.Presentations.create({"title": "MyNewPresentation"});
console.log("Created presentation with ID: " + presentation.presentationId);
}
새 슬라이드 만들기
function createSlide(presentationId) {
// You can specify the ID to use for the slide, as long as it's unique.
var pageId = Utilities.getUuid();
var requests = [{
"createSlide": {
"objectId": pageId,
"insertionIndex": 1,
"slideLayoutReference": {
"predefinedLayout": "TITLE_AND_TWO_COLUMNS"
}
}
}];
var slide =
Slides.Presentations.batchUpdate({'requests': requests}, presentationId);
console.log("Created Slide with ID: " + slide.replies[0].createSlide.objectId);
}
페이지 요소 객체 ID 읽기
function readPageElementIds(presentationId, pageId) {
// You can use a field mask to limit the data the API retrieves
// in a get request, or what fields are updated in an batchUpdate.
var response = Slides.Presentations.Pages.get(
presentationId, pageId, {"fields": "pageElements.objectId"});
console.log(response);
}
새 텍스트 상자 추가
function addTextBox(presentationId, pageId) {
// You can specify the ID to use for elements you create,
// as long as the ID is unique.
var pageElementId = Utilities.getUuid();
var requests = [{
"createShape": {
"objectId": pageElementId,
"shapeType": "TEXT_BOX",
"elementProperties": {
"pageObjectId": pageId,
"size": {
"width": {
"magnitude": 150,
"unit": "PT"
},
"height": {
"magnitude": 50,
"unit": "PT"
}
},
"transform": {
"scaleX": 1,
"scaleY": 1,
"translateX": 200,
"translateY": 100,
"unit": "PT"
}
}
}
}, {
"insertText": {
"objectId": pageElementId,
"text": "My Added Text Box",
"insertionIndex": 0
}
}];
var response =
Slides.Presentations.batchUpdate({'requests': requests}, presentationId);
console.log("Created Textbox with ID: " +
response.replies[0].createShape.objectId);
}
도형 텍스트 형식 설정
function formatShapeText(presentationId, shapeId) {
var requests = [{
"updateTextStyle": {
"objectId": shapeId,
"fields": "foregroundColor,bold,italic,fontFamily,fontSize,underline",
"style": {
"foregroundColor": {
"opaqueColor": {
"themeColor": "ACCENT5"
}
},
"bold": true,
"italic": true,
"underline": true,
"fontFamily": "Corsiva",
"fontSize": {
"magnitude": 18,
"unit": "PT"
}
},
"textRange": {
"type": "ALL"
}
}
}];
var response =
Slides.Presentations.batchUpdate({'requests': requests}, presentationId);
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-08-21(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-08-21(UTC)"],[[["The provided Google Apps Script code snippets demonstrate how to programmatically create and manipulate Google Slides presentations."],["The code covers functionalities such as creating presentations and slides, reading element IDs, adding text boxes, and formatting text within those boxes."],["Users can leverage these functions to automate presentation creation, customization, and content population, reducing manual effort and improving efficiency."],["Each function is independent and focuses on a specific task, allowing for flexibility in combining and using them to suit different use cases."],["Developers can adapt these examples to build more complex scripts for diverse slide manipulation scenarios within their applications or workflows."]]],[]]