IRONSOFTWAREHOME
从文本创建 DOCX
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");
Imports IronWord
Imports IronWord.Models

' Create textrun
Dim textRun As New TextContent("Sample text")

Dim paragraph As New Paragraph()
paragraph.AddChild(textRun)

' Create a new Word document
Dim doc As New WordDocument(paragraph)

' Export docx
doc.SaveAs("document.docx")
NuGet Download
PM > Install-Package IronWord
从文本创建 DOCX

从文本创建 DOCX

从文本创建新的 Word 文档也很简单。 提供任何文档结构对象,如section,以创建一个新的Word文档。 最后,使用SaveAs方法导出文档。

探索我们的 IronWord 文档元素教程
在 GitHub 上查看

准备开始了吗?

Nuget Downloads 56,401版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户