Enum HorizontalAlignment

HorizontalAlignment

การแจงนับประเภทการจัดข้อความแนวนอนที่รองรับ

หากต้องการเรียก enum คุณจะต้องเรียกคลาส ชื่อ และพร็อพเพอร์ตี้ระดับบนสุด เช่น DocumentApp.HorizontalAlignment.LEFT

ใช้การแจกแจง HorizontalAlignment เพื่อควบคุมการปรับแนวเนื้อหา Paragraph

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

// Insert a paragraph and a table at the start of document.
var par1 = body.insertParagraph(0, "Center");
var table = body.insertTable(1, [['Left', 'Right']]);
var par2 = table.getCell(0, 0).getChild(0).asParagraph();
var 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);

พร็อพเพอร์ตี้

พร็อพเพอร์ตี้Typeคำอธิบาย
LEFTEnumตัวเลือกการจัดข้อความชิดซ้าย
CENTEREnumตัวเลือกการจัดข้อความกึ่งกลาง
RIGHTEnumตัวเลือกการจัดข้อความชิดขวา
JUSTIFYEnumตัวเลือกการจัดแนวชิดขอบ