삽입된 이미지를 나타내는 요소입니다. List
또는 Paragraph
가 Footnote
내에 있지 않는 한 Inline
는 List
또는 Paragraph
내에 포함될 수 있습니다. Inline
자체는 다른 요소를 포함할 수 없습니다. 문서 구조에 관한 자세한 내용은 Google Docs 확장 가이드를 참고하세요.
메서드
메서드 | 반환 유형 | 간략한 설명 |
---|---|---|
copy() | Inline | 현재 요소의 분리된 전체 사본을 반환합니다. |
get | String | 이미지의 대체 설명을 반환합니다. |
get | String | 이미지의 대체 제목을 반환합니다. |
get | Blob | 이 객체 내의 데이터를 지정된 콘텐츠 유형으로 변환된 blob으로 반환합니다. |
get | Object | 요소의 속성을 가져옵니다. |
get | Blob | 이 객체 내부의 데이터를 blob으로 반환합니다. |
get | Integer | 이미지의 높이를 픽셀 단위로 가져옵니다. |
get | String | 링크 URL을 가져옵니다. |
get | Element | 요소의 다음 동위 요소를 가져옵니다. |
get | Container | 요소의 상위 요소를 가져옵니다. |
get | Element | 요소의 이전 동급 요소를 가져옵니다. |
get | Element | 요소의 Element 를 가져옵니다. |
get | Integer | 이미지의 너비(픽셀)를 가져옵니다. |
is | Boolean | 요소가 Document 의 끝에 있는지 여부를 확인합니다. |
merge() | Inline | 요소를 동일한 유형의 이전 형제 요소와 병합합니다. |
remove | Inline | 요소를 상위 요소에서 삭제합니다. |
set | Inline | 이미지의 대체 설명을 설정합니다. |
set | Inline | 이미지의 대체 제목을 설정합니다. |
set | Inline | 요소의 속성을 설정합니다. |
set | Inline | 이미지의 높이를 픽셀 단위로 설정합니다. |
set | Inline | 링크 URL을 설정합니다. |
set | Inline | 이미지의 너비를 픽셀 단위로 설정합니다. |
자세한 문서
copy()
현재 요소의 분리된 전체 사본을 반환합니다.
요소에 있는 하위 요소도 복사됩니다. 새 요소에 상위 요소가 없습니다.
리턴
Inline
- 새로운 문구입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Alt Description()
이미지의 대체 설명을 반환합니다.
리턴
String
- 대체 설명입니다. 요소에 대체 설명이 없는 경우 null
입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Alt Title()
이미지의 대체 제목을 반환합니다.
리턴
String
- 대체 제목입니다. 요소에 대체 제목이 없는 경우 null
입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get As(contentType)
이 객체 내의 데이터를 지정된 콘텐츠 유형으로 변환된 blob으로 반환합니다. 이 메서드는 파일 이름에 적절한 확장자(예: 'myfile.pdf')를 추가합니다. 하지만 마지막 마침표 뒤에 오는 파일 이름 부분이 대체해야 하는 기존 확장 프로그램이라고 가정합니다. 따라서 'ShoppingList.12.25.2014'는 'ShoppingList.12.25.pdf'가 됩니다.
전환의 일일 할당량을 보려면 Google 서비스 할당량을 참고하세요. 새로 생성된 Google Workspace 도메인에는 일시적으로 더 엄격한 할당량이 적용될 수 있습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
content | String | 변환할 MIME 유형입니다. 대부분의 블롭의 경우 'application/pdf' 만 사용할 수 있습니다. BMP, GIF, JPEG 또는 PNG 형식의 이미지의 경우 'image/bmp' , 'image/gif' , 'image/jpeg' 또는 'image/png' 도 유효합니다. Google Docs 문서의 경우 'text/markdown' 도 유효합니다. |
리턴
Blob
- 데이터를 blob으로 나타냅니다.
get Attributes()
요소의 속성을 가져옵니다.
결과는 각 속성 이름이 Document
열거형의 항목에 해당하는 유효한 요소 속성의 속성을 포함하는 객체입니다.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Append a styled paragraph. const par = body.appendParagraph('A bold, italicized paragraph.'); par.setBold(true); par.setItalic(true); // Retrieve the paragraph's attributes. const atts = par.getAttributes(); // Log the paragraph attributes. for (const att in atts) { Logger.log(`${att}:${atts[att]}`); }
리턴
Object
- 요소의 속성입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Blob()
get Height()
이미지의 높이를 픽셀 단위로 가져옵니다.
리턴
Integer
- 이미지의 높이(픽셀)
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Link Url()
링크 URL을 가져옵니다.
리턴
String
- 링크 URL입니다. 요소에 이 속성의 값이 여러 개 포함된 경우 null
입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Next Sibling()
get Parent()
요소의 상위 요소를 가져옵니다.
상위 요소에 현재 요소가 포함되어 있습니다.
리턴
Container
- 상위 요소입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Previous Sibling()
get Type()
요소의 Element
를 가져옵니다.
get
을 사용하여 지정된 요소의 정확한 유형을 확인합니다.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Obtain the first element in the active tab's body. const firstChild = body.getChild(0); // Use getType() to determine the element's type. if (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) { Logger.log('The first element is a paragraph.'); } else { Logger.log('The first element is not a paragraph.'); }
리턴
Element
: 요소 유형입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
get Width()
이미지의 너비(픽셀)를 가져옵니다.
리턴
Integer
- 이미지의 너비(픽셀)
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
is At Document End()
merge()
요소를 동일한 유형의 이전 형제 요소와 병합합니다.
동일한 Element
의 요소만 병합할 수 있습니다. 현재 요소에 포함된 하위 요소는 이전 형제 요소로 이동됩니다.
현재 요소가 문서에서 삭제됩니다.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Example 1: Merge paragraphs // Append two paragraphs to the document's active tab. const par1 = body.appendParagraph('Paragraph 1.'); const par2 = body.appendParagraph('Paragraph 2.'); // Merge the newly added paragraphs into a single paragraph. par2.merge(); // Example 2: Merge table cells // Create a two-dimensional array containing the table's cell contents. const cells = [ ['Row 1, Cell 1', 'Row 1, Cell 2'], ['Row 2, Cell 1', 'Row 2, Cell 2'], ]; // Build a table from the array. const table = body.appendTable(cells); // Get the first row in the table. const row = table.getRow(0); // Get the two cells in this row. const cell1 = row.getCell(0); const cell2 = row.getCell(1); // Merge the current cell into its preceding sibling element. const merged = cell2.merge();
리턴
Inline
- 병합된 요소입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
remove From Parent()
요소를 상위 요소에서 삭제합니다.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Remove all images in the active tab's body. const imgs = body.getImages(); for (let i = 0; i < imgs.length; i++) { imgs[i].removeFromParent(); }
리턴
Inline
: 삭제된 요소입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Alt Description(description)
이미지의 대체 설명을 설정합니다. 제공된 제목이 null
인 경우 설명을 빈 문자열로 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
description | String | 대체 설명입니다. |
리턴
Inline
- 현재 객체입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Alt Title(title)
이미지의 대체 제목을 설정합니다. 지정된 제목이 null
인 경우 제목을 빈 문자열로 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
title | String | 대체 제목입니다. |
리턴
Inline
- 현재 객체입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Attributes(attributes)
요소의 속성을 설정합니다.
지정된 속성 매개변수는 각 속성 이름이 Document
열거형의 항목이고 각 속성 값이 적용할 새 값인 객체여야 합니다.
const doc = DocumentApp.getActiveDocument(); const documentTab = doc.getActiveTab().asDocumentTab(); const body = documentTab.getBody(); // Define a custom paragraph style. const style = {}; style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT; style[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri'; style[DocumentApp.Attribute.FONT_SIZE] = 18; style[DocumentApp.Attribute.BOLD] = true; // Append a plain paragraph. const par = body.appendParagraph('A paragraph with custom style.'); // Apply the custom style. par.setAttributes(style);
매개변수
이름 | 유형 | 설명 |
---|---|---|
attributes | Object | 요소의 속성입니다. |
리턴
Inline
- 현재 요소
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Height(height)
이미지의 높이를 픽셀 단위로 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
height | Integer | 이미지의 높이(픽셀) |
리턴
Inline
- 현재 객체
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Link Url(url)
링크 URL을 설정합니다. 지정된 URL이 null
이거나 빈 문자열인 경우 이 메서드는 빈 URL이 있는 링크를 만듭니다. 이 링크는 Google Docs에서 '잘못된 링크'로 표시될 수 있습니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
url | String | 링크 URL입니다. |
리턴
Inline
- 현재 객체입니다.
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
set Width(width)
이미지의 너비를 픽셀 단위로 설정합니다.
매개변수
이름 | 유형 | 설명 |
---|---|---|
width | Integer | 이미지의 너비(픽셀) |
리턴
Inline
- 현재 객체
승인
이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상의 승인이 필요합니다.
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents