Class InlineDrawing

InlineDrawing

삽입된 그림을 나타내는 요소입니다. ListItem 또는 ParagraphFootnoteSection 내에 있지 않는 한 InlineDrawingListItem 또는 Paragraph 내에 포함될 수 있습니다. InlineDrawing 자체는 다른 요소를 포함할 수 없습니다. 문서 구조에 대한 자세한 내용은 Google 문서 확장 가이드를 참조하세요.

메서드

메서드반환 유형간략한 설명
copy()InlineDrawing현재 요소의 분리된 딥 카피를 반환합니다.
getAltDescription()String그림의 대체 설명을 반환합니다.
getAltTitle()String그림의 대체 제목을 반환합니다.
getAttributes()Object요소의 속성을 검색합니다.
getNextSibling()Element요소의 다음 동위 요소를 검색합니다.
getParent()ContainerElement요소의 상위 요소를 검색합니다.
getPreviousSibling()Element요소의 이전 동위 요소를 검색합니다.
getType()ElementType요소의 ElementType를 검색합니다.
isAtDocumentEnd()Boolean요소가 Document 끝에 있는지 결정합니다.
merge()InlineDrawing요소를 동일한 유형의 선행 동위와 병합합니다.
removeFromParent()InlineDrawing상위 요소로부터 요소를 삭제합니다.
setAltDescription(description)InlineDrawing그림의 대체 설명을 설정합니다.
setAltTitle(title)InlineDrawing그림의 대체 제목을 설정합니다.
setAttributes(attributes)InlineDrawing요소의 속성을 설정합니다.

자세한 문서

copy()

현재 요소의 분리된 딥 카피를 반환합니다.

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

Return

InlineDrawing: 새 사본입니다.

승인

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

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

getAltDescription()

그림의 대체 설명을 반환합니다.

Return

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

승인

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

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

getAltTitle()

그림의 대체 제목을 반환합니다.

Return

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

승인

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

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

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]);
}

Return

Object — 요소의 속성입니다.

승인

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

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

getNextSibling()

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

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

Return

Element: 다음 동위 요소입니다.

승인

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

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

getParent()

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

상위 요소에 현재 요소가 포함되어 있습니다.

Return

ContainerElement: 상위 요소입니다.

승인

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

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

getPreviousSibling()

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

이전 동위 요소는 동일한 상위 요소를 가지며 현재 요소보다 선행합니다.

Return

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

Return

ElementType: 요소 유형입니다.

승인

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

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

isAtDocumentEnd()

요소가 Document 끝에 있는지 결정합니다.

Return

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();

Return

InlineDrawing — 병합된 요소입니다.

승인

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

  • 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();
}

Return

InlineDrawing — 삭제된 요소입니다.

승인

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

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

setAltDescription(description)

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

매개변수

이름유형설명
descriptionString대체 제목

Return

InlineDrawing: 현재 객체

승인

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

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

setAltTitle(title)

그림의 대체 제목을 설정합니다. 제목이 null인 경우 제목을 빈 문자열로 설정합니다.

매개변수

이름유형설명
titleString대체 제목

Return

InlineDrawing: 현재 객체

승인

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

  • 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요소의 속성입니다.

Return

InlineDrawing: 현재 요소입니다.

승인

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

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