עבודה עם אסיאתי Typography

טייפוגרפיה אסיה היא קבוצה של אפשרויות לפסקאות טקסט במסמכים שנכתבו בשפות אסיה.

Aspose.Words תמיכה אסיאתית Typography באמצעות 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);

אפשרויות ל- Line Break Options

הכרטיסיה האסייתית טיפוגרפיה של תיבת הדו-שיח התכונות של פסקה 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);

שינוי Paragraph אסיה ספיגה ו Indents

הדוגמה הבאה של הקוד מראה כיצד לשנות את סעיף האסיאתי שמצמצמצוץ ומבודדים:

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