Class InlineImage

InlineImage

삽입된 이미지를 나타내는 요소입니다. InlineImageListItem 또는 Paragraph 내에 포함될 수 있습니다. 단, ListItem 또는 ParagraphFootnoteSection 내에 있지 않아야 합니다. InlineImage 자체는 다른 요소를 포함할 수 없습니다. 문서 구조에 관한 자세한 내용은 Google 문서 확장 가이드를 참고하세요.

방법

메서드반환 유형간략한 설명
copy()InlineImage현재 요소의 분리된 전체 사본을 반환합니다.
getAltDescription()String이미지의 대체 설명을 반환합니다.
getAltTitle()String이미지의 대체 제목을 반환합니다.
getAs(contentType)Blob이 객체 내의 데이터를 지정된 콘텐츠 유형으로 변환된 blob으로 반환합니다.
getAttributes()Object요소의 속성을 검색합니다.
getBlob()Blob이 객체 내의 데이터를 blob으로 반환합니다.
getHeight()Integer이미지의 높이를 픽셀 단위로 검색합니다.
getLinkUrl()String링크 URL을 검색합니다.
getNextSibling()Element요소의 다음 동위 요소를 검색합니다.
getParent()ContainerElement요소의 상위 요소를 검색합니다.
getPreviousSibling()Element요소의 이전 동위 요소를 검색합니다.
getType()ElementType요소의 ElementType를 검색합니다.
getWidth()Integer이미지의 너비를 픽셀 단위로 검색합니다.
isAtDocumentEnd()Boolean요소가 Document의 끝에 있는지 확인합니다.
merge()InlineImage동일한 유형의 이전 동위 요소와 요소를 병합합니다.
removeFromParent()InlineImage상위 항목에서 요소를 삭제합니다.
setAltDescription(description)InlineImage이미지의 대체 설명을 설정합니다.
setAltTitle(title)InlineImage이미지의 대체 제목을 설정합니다.
setAttributes(attributes)InlineImage요소의 속성을 설정합니다.
setHeight(height)InlineImage이미지의 높이를 픽셀 단위로 설정합니다.
setLinkUrl(url)InlineImage링크 URL을 설정합니다.
setWidth(width)InlineImage이미지의 너비를 픽셀 단위로 설정합니다.

자세한 문서

copy()

현재 요소의 분리된 전체 사본을 반환합니다.

요소에 있는 모든 하위 요소도 복사됩니다. 새 요소에는 상위 요소가 없습니다.

리턴

InlineImage - 새 사본입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getAltDescription()

이미지의 대체 설명을 반환합니다.

리턴

String: 대체 제목 또는 null(요소에 대체 제목이 없는 경우)

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getAltTitle()

이미지의 대체 제목을 반환합니다.

리턴

String: 대체 제목 또는 null(요소에 대체 제목이 없는 경우)

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getAs(contentType)

이 객체 내의 데이터를 지정된 콘텐츠 유형으로 변환된 blob으로 반환합니다. 이 메서드는 파일 이름에 적절한 확장자(예: 'myfile.pdf')를 추가합니다. 그러나 파일 이름에서 마지막 마침표 다음에 오는 부분 (있는 경우)이 대체되어야 하는 기존 확장자라고 가정합니다. 따라서 'ShoppingList.12.25.2014'는 'ShoppingList.12.25.pdf'가 됩니다.

변환의 일일 할당량을 보려면 Google 서비스 할당량을 참조하세요. 새로 생성된 Google Workspace 도메인에는 일시적으로 더 엄격한 할당량이 적용될 수 있습니다.

매개변수

이름유형설명
contentTypeString변환할 MIME 유형입니다. 대부분의 blob에서 'application/pdf'가 유일하게 유효한 옵션입니다. BMP, GIF, JPEG 또는 PNG 형식의 이미지의 경우 'image/bmp', 'image/gif', 'image/jpeg', 'image/png' 중 어느 것도 사용할 수 있습니다.

리턴

Blob - blob 형식의 데이터입니다.


getAttributes()

요소의 속성을 검색합니다.

결과는 각 유효한 요소 속성의 속성을 포함하는 객체입니다. 각 속성 이름은 DocumentApp.Attribute 열거형의 항목에 상응합니다.

var body = DocumentApp.getActiveDocument().getBody();

// Append a styled paragraph.
var par = body.appendParagraph('A bold, italicized paragraph.');
par.setBold(true);
par.setItalic(true);

// Retrieve the paragraph's attributes.
var atts = par.getAttributes();

// Log the paragraph attributes.
for (var att in atts) {
  Logger.log(att + ":" + atts[att]);
}

리턴

Object - 요소의 속성입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getBlob()

이 객체 내의 데이터를 blob으로 반환합니다.

리턴

Blob - blob 형식의 데이터입니다.


getHeight()

이미지의 높이를 픽셀 단위로 검색합니다.

리턴

Integer: 이미지의 높이(픽셀)

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getLinkUrl()

링크 URL을 검색합니다.

리턴

String - 링크 URL 또는 null(요소에 이 속성의 값이 여러 개 포함된 경우)입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getNextSibling()

요소의 다음 동위 요소를 검색합니다.

다음 동위 요소는 동일한 상위 요소를 가지며 현재 요소를 따릅니다.

리턴

Element - 다음 동위 요소

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getParent()

요소의 상위 요소를 검색합니다.

상위 요소에는 현재 요소가 포함됩니다.

리턴

ContainerElement - 상위 요소입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getPreviousSibling()

요소의 이전 동위 요소를 검색합니다.

이전 동위 요소가 동일한 상위 요소를 가지며 현재 요소 앞에 옵니다.

리턴

Element - 이전의 동위 요소

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getType()

요소의 ElementType를 검색합니다.

getType()를 사용하여 주어진 요소의 정확한 유형을 확인합니다.

var body = DocumentApp.getActiveDocument().getBody();

// Obtain the first element in the document body.

var 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.');
}

리턴

ElementType - 요소 유형입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getWidth()

이미지의 너비를 픽셀 단위로 검색합니다.

리턴

Integer: 이미지의 너비(픽셀)

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

isAtDocumentEnd()

요소가 Document의 끝에 있는지 확인합니다.

리턴

Boolean - 요소가 문서의 끝에 있는지 여부입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

merge()

동일한 유형의 이전 동위 요소와 요소를 병합합니다.

동일한 ElementType의 요소만 병합할 수 있습니다. 현재 요소에 포함된 모든 하위 요소는 이전의 동위 요소로 이동합니다.

현재 요소가 문서에서 삭제됩니다.

var body = DocumentApp.getActiveDocument().getBody();
// Example 1: Merge paragraphs
// Append two paragraphs to the document.
var par1 = body.appendParagraph('Paragraph 1.');
var 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.
var cells = [
['Row 1, Cell 1', 'Row 1, Cell 2'],
['Row 2, Cell 1', 'Row 2, Cell 2']
];
// Build a table from the array.
var table = body.appendTable(cells);
// Get the first row in the table.
 var row = table.getRow(0);
// Get the two cells in this row.
var cell1 = row.getCell(0);
var cell2 = row.getCell(1);
// Merge the current cell into its preceding sibling element.
var merged = cell2.merge();

리턴

InlineImage - 병합된 요소입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

removeFromParent()

상위 항목에서 요소를 삭제합니다.

var body = DocumentApp.getActiveDocument().getBody();

// Remove all images in the document body.
var imgs = body.getImages();
for (var i = 0; i < imgs.length; i++) {
  imgs[i].removeFromParent();
}

리턴

InlineImage - 삭제된 요소입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setAltDescription(description)

이미지의 대체 설명을 설정합니다. 지정된 제목이 null이면 설명을 빈 문자열로 설정합니다.

매개변수

이름유형설명
descriptionString대체 제목

리턴

InlineImage — 현재 객체

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setAltTitle(title)

이미지의 대체 제목을 설정합니다. 지정된 제목이 null이면 제목을 빈 문자열로 설정합니다.

매개변수

이름유형설명
titleString대체 제목

리턴

InlineImage — 현재 객체

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setAttributes(attributes)

요소의 속성을 설정합니다.

지정된 속성 매개변수는 각 속성 이름이 DocumentApp.Attribute 열거형의 항목이고 각 속성 값이 적용될 새 값인 객체여야 합니다.

var body = DocumentApp.getActiveDocument().getBody();

// Define a custom paragraph style.
var 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.
var par = body.appendParagraph('A paragraph with custom style.');

// Apply the custom style.
par.setAttributes(style);

매개변수

이름유형설명
attributesObject요소의 속성입니다.

리턴

InlineImage - 현재 요소입니다.

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setHeight(height)

이미지의 높이를 픽셀 단위로 설정합니다.

매개변수

이름유형설명
heightInteger이미지의 높이(픽셀)

리턴

InlineImage — 현재 객체

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setLinkUrl(url)

링크 URL을 설정합니다. 지정된 URL이 null이거나 빈 문자열인 경우 이 메서드는 Google Docs에서 '잘못된 링크'로 표시될 수 있는 빈 URL이 포함된 링크를 만듭니다.

매개변수

이름유형설명
urlString링크 URL입니다.

리턴

InlineImage — 현재 객체

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

setWidth(width)

이미지의 너비를 픽셀 단위로 설정합니다.

매개변수

이름유형설명
widthInteger이미지의 너비(픽셀)

리턴

InlineImage — 현재 객체

승인

이 방법을 사용하는 스크립트는 다음 범위 중 하나 이상을 승인해야 합니다.

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents