การทำงานกับตัวอักษรเอเชีย

Asian Typography คือชุดตัวเลือกสำหรับย่อหน้าข้อความในเอกสารที่เขียนในภาษาเอเชีย

Aspose.Words รองรับ Asian Typography โดยใช้คลาส ParagraphFormat และคุณสมบัติบางอย่าง

ปรับช่องว่างระหว่างข้อความหรือตัวเลขเอเชียและละตินโดยอัตโนมัติ

หากคุณกำลังออกแบบเทมเพลตที่มีทั้งข้อความเอเชียตะวันออกและละติน และต้องการปรับปรุงลักษณะที่ปรากฏของเทมเพลตฟอร์มของคุณโดยการควบคุมช่องว่างระหว่างข้อความทั้งสองชนิด คุณสามารถกำหนดค่าเทมเพลตของคุณฟอร์มเพื่อปรับช่องว่างระหว่างข้อความทั้งสองชนิดนี้โดยอัตโนมัติ. เพื่อให้บรรลุเป้าหมายนี้ คุณสามารถใช้คุณสมบัติ AddSpaceBetweenFarEastAndAlpha และ AddSpaceBetweenFarEastAndDigit ของคลาส ParagraphFormat ได้

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีการใช้คุณสมบัติ AddSpaceBetweenFarEastAndAlpha และ AddSpaceBetweenFarEastAndDigit:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Set paragraph formatting properties
ParagraphFormat paragraphFormat = builder.ParagraphFormat;
paragraphFormat.AddSpaceBetweenFarEastAndAlpha = true;
paragraphFormat.AddSpaceBetweenFarEastAndDigit = true;
builder.Writeln("Automatically adjust space between Asian and Latin text");
builder.Writeln("Automatically adjust space between Asian text and numbers");
dataDir = dataDir + "DocumentBuilderSetSpacebetweenAsianandLatintext.doc";
doc.Save(dataDir);

ตั้งค่าตัวเลือกตัวแบ่งบรรทัด

แท็บ Asian Typography ของกล่องโต้ตอบคุณสมบัติย่อหน้าใน Microsoft Word มีกลุ่มตัวแบ่งบรรทัด ตัวเลือกของกลุ่มนี้สามารถตั้งค่าได้โดยใช้คุณสมบัติ FarEastLineBreakControl, WordWrap, HangingPunctuation ของคลาส ParagraphFormat

ตัวอย่างโค้ดต่อไปนี้แสดงวิธีการใช้คุณสมบัติเหล่านี้:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document(dataDir + "Input.docx");
ParagraphFormat format = doc.FirstSection.Body.Paragraphs[0].ParagraphFormat;
format.FarEastLineBreakControl = false;
format.WordWrap = true;
format.HangingPunctuation = false;
dataDir = dataDir + "SetAsianTypographyLinebreakGroupProp_out.docx";
doc.Save(dataDir);