aspose words 怎么设置SetFarEastLineBreakControl
时间: 2023-12-10 07:40:29 浏览: 34
Aspose.Words是一个强大的文档处理API,可以用来创建、读取、修改和转换各种文档格式,包括Word文档。
在Aspose.Words中,要设置SetFarEastLineBreakControl属性,可以按照以下步骤进行操作:
1. 首先,获取文档的Document对象。
```csharp
Document doc = new Document("input.docx");
```
2. 然后,获取文档的PageSetup对象。
```csharp
PageSetup ps = doc.FirstSection.PageSetup;
```
3. 最后,设置SetFarEastLineBreakControl属性。
```csharp
ps.SetFarEastLineBreakControl(LineBreakControl.Strict);
```
这里将SetFarEastLineBreakControl属性设置为LineBreakControl.Strict。根据官方文档,LineBreakControl枚举有以下三个值:
- None:不控制远东语言的换行。
- Normal:自动控制远东语言的换行。
- Strict:强制控制远东语言的换行。
设置完毕后,可以将文档保存到文件或流中。
```csharp
doc.Save("output.docx", SaveFormat.Docx);
```
相关问题
aspose 设置SetFarEastLineBreakControl无效
如果你在使用Aspose的时候设置SetFarEastLineBreakControl无效,可能是因为你没有正确设置该属性。请确保按照以下步骤进行设置:
1. 首先,你需要创建一个Document对象,然后使用DocumentBuilder类来构建文档。
2. 然后,你需要使用DocumentBuilder的ParagraphFormat属性来获取段落格式对象,并设置SetFarEastLineBreakControl属性。
下面是一个示例代码片段,展示了如何设置SetFarEastLineBreakControl属性:
```
// 创建一个Document对象
Document doc = new Document();
// 创建DocumentBuilder对象
DocumentBuilder builder = new DocumentBuilder(doc);
// 获取ParagraphFormat对象并设置SetFarEastLineBreakControl属性
ParagraphFormat paraFormat = builder.ParagraphFormat;
paraFormat.SetFarEastLineBreakControl(true);
```
如果你仍然遇到问题,请检查你的Aspose版本是否最新,并且查看文档中的其他设置选项。
aspose setFarEastLineBreakControl
Aspose setFarEastLineBreakControl is a method provided by Aspose.Words, a popular document processing library for .NET and Java. This method is used to control how line breaks are handled in Far East languages such as Chinese, Japanese, and Korean when rendering or printing documents.
When set to true, this method enables the control of line breaks in Far East languages by inserting zero-width spaces between certain characters. When set to false, the default line break control is used.
Here is an example code snippet that demonstrates how to use the setFarEastLineBreakControl method:
```
Document doc = new Document("input.docx");
// Enable line break control for Far East languages
doc.LayoutOptions.SetFarEastLineBreakControl(true);
// Save the document with line break control enabled
doc.Save("output.docx");
```
By using this method, you can ensure that your Far East language documents are rendered or printed correctly, with proper line breaks and spacing.