從文字建立 DOCX
從文字建立新的 Word 文件也很簡單。 傳遞任何文件結構物件(例如段落、表格或章節)以實例化一個新的 Word 文件。 Finally, use the SaveAs method to export the document.
準備好開始了嗎?
Nuget 下載 28,054 | 版本: 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");Imports IronWord
Imports IronWord.Models
' Create textrun
Private textRun As New TextContent("Sample text")
Private paragraph As New Paragraph()
paragraph.AddChild(textRun)
' Create a new Word document
Dim doc As New WordDocument(paragraph)
' Export docx
doc.SaveAs("document.docx")Install-Package IronWord
從文字建立新的 Word 文件也很簡單。 傳遞任何文件結構物件(例如段落、表格或章節)以實例化一個新的 Word 文件。 Finally, use the SaveAs method to export the document.