Enum HorizontalAlignment
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
가로정렬
지원되는 가로 정렬 유형의 열거형입니다.
enum을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. 예를 들면
DocumentApp.HorizontalAlignment.LEFT
입니다.
HorizontalAlignment
열거형을 사용하여 Paragraph
콘텐츠의 정렬을 조작합니다.
const body =
DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();
// Insert a paragraph and a table at the start of the tab.
const par1 = body.insertParagraph(0, 'Center');
const table = body.insertTable(1, [['Left', 'Right']]);
const par2 = table.getCell(0, 0).getChild(0).asParagraph();
const par3 = table.getCell(0, 0).getChild(0).asParagraph();
// Center align the first paragraph.
par1.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
// Left align the first cell.
par2.setAlignment(DocumentApp.HorizontalAlignment.LEFT);
// Right align the second cell.
par3.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);
속성
속성 | 유형 | 설명 |
LEFT | Enum | 왼쪽 정렬 옵션 |
CENTER | Enum | 가운데 정렬 옵션 |
RIGHT | Enum | 오른쪽 정렬 옵션 |
JUSTIFY | Enum | justify-alignment 옵션 |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eHorizontalAlignment\u003c/code\u003e is used to set the horizontal alignment of paragraph content within Google Docs.\u003c/p\u003e\n"],["\u003cp\u003eIt provides options for left, center, right, and justify alignment through its properties (\u003ccode\u003eLEFT\u003c/code\u003e, \u003ccode\u003eCENTER\u003c/code\u003e, \u003ccode\u003eRIGHT\u003c/code\u003e, \u003ccode\u003eJUSTIFY\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eYou can access these alignment options using the syntax \u003ccode\u003eDocumentApp.HorizontalAlignment.ALIGNMENT_TYPE\u003c/code\u003e, where \u003ccode\u003eALIGNMENT_TYPE\u003c/code\u003e is one of the properties mentioned above.\u003c/p\u003e\n"]]],[],null,["# Enum HorizontalAlignment\n\nHorizontalAlignment\n\nAn enumeration of the supported horizontal alignment types.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nDocumentApp.HorizontalAlignment.LEFT`.\n\nUse the `Horizontal``Alignment` enumeration to manipulate the alignment of [Paragraph](/apps-script/reference/document/paragraph) contents.\n\n```javascript\nconst body =\n DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();\n\n// Insert a paragraph and a table at the start of the tab.\nconst par1 = body.insertParagraph(0, 'Center');\nconst table = body.insertTable(1, [['Left', 'Right']]);\nconst par2 = table.getCell(0, 0).getChild(0).asParagraph();\nconst par3 = table.getCell(0, 0).getChild(0).asParagraph();\n\n// Center align the first paragraph.\npar1.setAlignment(DocumentApp.HorizontalAlignment.CENTER);\n\n// Left align the first cell.\npar2.setAlignment(DocumentApp.HorizontalAlignment.LEFT);\n\n// Right align the second cell.\npar3.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|-----------|--------|-------------------------------|\n| `LEFT` | `Enum` | The left-alignment option. |\n| `CENTER` | `Enum` | The center-alignment option. |\n| `RIGHT` | `Enum` | The right-alignment option. |\n| `JUSTIFY` | `Enum` | The justify-alignment option. |"]]