Aspose.Words builder.InsertHtml(html) 设置段落的 中文版式 文本对齐方式为居中
时间: 2024-03-23 20:40:40 浏览: 109

易语言源码设置文本对齐方式.rar
您可以使用以下代码将Aspose.Words中插入的HTML文本设置为居中对齐:
```
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(html);
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
{
para.ParagraphFormat.Alignment = ParagraphAlignment.Center;
}
```
这里的 `html` 是您要插入的HTML文本。代码将HTML文本插入到 `doc` 中,然后使用 `foreach` 循环遍历所有段落,并将它们的对齐方式设置为居中。
阅读全文
相关推荐














