![](/img/trans.png)
[英]How to send “<” characters to Word documents (.doc, docx) using Sendkeys method
[英]How to change background color with DocX (Microsoft Word) documents
我正在嘗試更改 Word 文檔中的背景顏色(僅適用於幾個單詞)。
我正在使用 DocX ( https://docx.codeplex.com/SourceControl/latest#Examples/Program.cs ),但我找不到任何允許我這樣做的方法/屬性。
這是我的代碼:
var rb = new Formatting();
rb.UnderlineColor = this.GetResultColor(stu.RespectfulBehavior);
rb.FontColor = this.GetResultColor(stu.RespectfulBehavior);
templ.ReplaceText(PlaceHolders.RespectfulBehaviour.GetDisplayName(), " ", newFormatting: rb);
綜觀的DOCX源代碼格式在課堂上我會說,你要找的Highlight
。 所以如果你想要一些用藍色突出顯示的東西
rb.Highlight = Highlight.blue;
編輯:這個問題似乎已經回答了https://stackoverflow.com/a/30141775/2039359
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.