使用亚洲版式
亚洲版式是针对以亚洲语言编写的文档中的文本段落的一组选项。
Aspose.Words 使用 ParagraphFormat 类及其一些属性支持亚洲版式。
自动调整亚洲和拉丁文本或数字之间的间距
如果您正在设计包含东亚和拉丁文本的模板,并且希望通过控制两种类型文本之间的间距来增强表单模板的外观,则可以将表单模板配置为自动调整这两种类型文本之间的间距。为此,您可以使用 ParagraphFormat
类的 AddSpaceBetweenFarEastAndAlpha 和 AddSpaceBetweenFarEastAndDigit 属性。
以下代码示例显示如何使用 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); |
设置换行选项
Microsoft Word 中段落属性对话框的亚洲版式选项卡具有换行符组。该组的选项可以使用 ParagraphFormat 类的 FarEastLineBreakControl、WordWrap、HangingPunctuation 属性进行设置。
以下代码示例展示了如何使用这些属性:
// 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); |