添加段落 IronWord 中的"新增段落"功能可讓開發人員將整個段落插入到現有的 Word 文件中,從而提供了一種有效建構和組織內容的方法。 透過新增段落,開發人員可以將格式不同的多段文字合併成一個連貫的文字區塊。 此功能對於建立需要將文字分組並設定樣式的動態文件(例如報告、文章或信件)尤其有用。 它在文字呈現方式上提供了靈活性,允許在單一段落中包含各種格式選項,如粗體、斜體和其他樣式。 添加段落的功能有助於保持文件結構的清晰性,並確保內容組織得當,以便於閱讀。 Adding Paragraphs in C The Paragraph class in IronWord represents a block of text that can contain both unstyled text and styled content. When working with paragraphs, developers can combine plain TextContent with styled Run objects to create rich, formatted text blocks. To add plain text directly to a paragraph, use the AddText method with a TextContent object. This is ideal for unstyled text that doesn't require specific formatting. For styled content, create a Run object containing TextContent, then assign a TextStyle to the Run. The TextStyle can specify formatting such as bold, italic, font family, font size, and color. Once the Run is styled, use the AddChild method to add it to the paragraph. This method is specifically designed for adding Run objects with formatting. A single paragraph can contain multiple runs with different styles, allowing for flexible text formatting within a unified block. After constructing the paragraph with all desired content, use AddParagraph on the WordDocument to insert it into the document. This approach follows the document hierarchy: WordDocument → DocumentSection → Paragraph → Run → TextContent, ensuring proper structure and formatting preservation when the document is saved. 使用 IronWord 探索更多關於文件元素的信息 相關文檔連結 在 GitHub 上查看 相關教程 相關操作指南 類文檔 下載 IronWord DLL 回報此頁面的問題 準備好開始了嗎? Nuget 下載 36,374 | 版本: 2026.3 剛剛發布 開始免費試用 免費 NuGet 下載 總下載量:36,374 查看許可證 還在捲動嗎? 想要快速證明? PM > Install-Package IronWord 執行範例 觀看您的資料變成 Word doc。 免費 NuGet 下載 總下載量:36,374 查看許可證