การทำงานกับตัวอักษรเอเชีย
พิมพ์เอเชียเป็นชุดของตัวเลือกสำหรับย่อหน้าข้อความในเอกสารที่เขียนในภาษาเอเชีย.
Aspose.Wordsรองรับการพิมพ์เอเชียโดยใช้ชั้นเรียนParagraphFormatและบางส่วนของคุณสมบัติของมัน.
ปรับช่องว่างโดยอัตโนมัติระหว่างข้อความหรือตัวเลขเอเชียและละติน
ลักษณะที่ปรากฏของแม่แบบฟอร์มโดยการควบคุมช่องว่างระหว่างข้อความทั้งสองชนิดคุณส เพื่อให้บรรลุนี้คุณสามารถใช้AddSpaceBetweenFarEastAndAlphaและAddSpaceBetweenFarEastAndDigitคุณสมบัติของParagraphFormat
คลาส.
ตัวอย่างรหัสต่อไปนี้แสดงวิธีใช้คุณสมบัติAddSpaceBetweenFarEastAndAlphaและAddSpaceBetweenFarEastAndDigit:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(); | |
DocumentBuilder builder = new DocumentBuilder(doc); | |
// Set paragraph formatting properties | |
ParagraphFormat paragraphFormat = builder.getParagraphFormat(); | |
paragraphFormat.setAddSpaceBetweenFarEastAndAlpha(true); | |
paragraphFormat.setAddSpaceBetweenFarEastAndDigit(true); | |
builder.writeln("Automatically adjust space between Asian and Latin text"); | |
builder.writeln("Automatically adjust space between Asian text and numbers"); | |
dataDir = dataDir + "DocumentBuilderSetSpacebetweenAsianandLatintext_out.doc"; | |
doc.save(dataDir); |
ตั้งค่าตัวเลือกแบ่งบรรทัด
แท็บการพิมพ์เอเชียของกล่องโต้ตอบคุณสมบัติย่อหน้าในMicrosoft Wordมีกลุ่มแบ่งบรรทัด ตัวเลือกของกลุ่มนี้สามารถตั้งค่าได้โดยใช้FarEastLineBreakControl, WordWrap, HangingPunctuation คุณสมบัติของParagraphFormatชั้น.
ตัวอย่างรหัสต่อไปนี้แสดงวิธีการใช้คุณสมบัติเหล่านี้:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(dataDir + "Input.docx"); | |
ParagraphFormat format = doc.getFirstSection().getBody().getParagraphs().get(0).getParagraphFormat(); | |
format.setFarEastLineBreakControl(false); | |
format.setWordWrap(true); | |
format.setHangingPunctuation(false); | |
dataDir = dataDir + "SetAsianTypographyLinebreakGroupProp_out.doc"; | |
doc.save(dataDir); |
เปลี่ยนระยะห่างย่อหน้าเอเชียและเยื้อง
ตัวอย่างรหัสต่อไปนี้แสดงวิธีการเปลี่ยนระยะห่างย่อหน้าเอเชียและเยื้อง:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(dataDir + "Input.docx"); | |
ParagraphFormat format = doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat(); | |
format.setCharacterUnitLeftIndent(10); // ParagraphFormat.LeftIndent will be updated | |
format.setCharacterUnitRightIndent(10); // ParagraphFormat.RightIndent will be updated | |
format.setCharacterUnitFirstLineIndent(20); // ParagraphFormat.FirstLineIndent will be updated | |
format.setLineUnitBefore(5); // ParagraphFormat.SpaceBefore will be updated | |
format.setLineUnitAfter(10); // ParagraphFormat.SpaceAfter will be updated | |
dataDir = dataDir + "ChangeAsianParagraphSpacingandIndents_out.doc"; | |
doc.save(dataDir); |