新增文字大綱

新增文字輪廓效果

文字輪廓效果透過在每個字元周圍繪製邊框,來提升文字的可讀性與風格。 此效果特別適用於製作粗體、引人注目的文字,或在文字出現在圖片或彩色背景上時確保可讀性。 IronWord provides the TextOutlineEffect class with preset configurations for quick implementation.

To apply a text outline, create a TextStyle object and configure its TextEffect property with TextOutlineEffect.DefaultEffect. 此預設設定提供了一套標準的綱要配置,適用於大多數情境。 針對自訂大綱,開發人員可指定大綱寬度、顏色及線條樣式等屬性,以實現特定的視覺效果。

After setting up the text style, create a Run containing the desired TextContent and assign the configured style to the run's Style property. Use AddChild to add the styled run to a paragraph, then add the paragraph to the document. 此結構化方法可確保格式正確,並維持文件的完整性。

程式碼說明

使用 IronWord 為文字套用大綱格式非常簡單。 儘管結構簡潔,但文本大綱的每個屬性皆可依需求進行調整。 Once a Word document is imported, the textStyle is configured to include a text outline effect by assigning TextOutlineEffect.DefaultEffect to the TextOutlineEffect property of a new TextEffect instance.

To apply this effect to text, a Paragraph is created, then a Run object is created containing the desired TextContent. The configured textStyle is assigned to the Run, applying the text outline effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. 此文件遵循以下層級結構:文件 → 段落 → 執行 → 文字內容。 最後,文件被匯出。

透過 IronWord 進一步了解文件元素。

準備開始了嗎?
Nuget 下載 44,103 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronWord
執行範例 觀看您的資料轉為 WORD 文件。