从文本创建 DOCX
从文本创建新的 Word 文档也很简单。 传递任何文档结构对象(例如段落、表格或章节)以实例化一个新的 Word 文档。 Finally, use the SaveAs method to export the document.
准备开始了吗?
Nuget 下载 29,594 | 版本: 2025.12 刚刚发布
using IronWord;
using IronWord.Models;
// Create textrun
TextContent textRun = new TextContent("Sample text");
Paragraph paragraph = new Paragraph();
paragraph.AddChild(textRun);
// Create a new Word document
WordDocument doc = new WordDocument(paragraph);
// Export docx
doc.SaveAs("document.docx");Install-Package IronWord
从文本创建新的 Word 文档也很简单。 传递任何文档结构对象(例如段落、表格或章节)以实例化一个新的 Word 文档。 Finally, use the SaveAs method to export the document.