1
我有幾個段落用不同的文字顏色有些話創建文件的代碼。就像:WORDPROCESSINGML。如何將背景顏色分配給文本?
using (var doc = WordprocessingDocument.Create("some-file-name", WordprocessingDocumentType.Document))
{
// Add a new main document part.
var mainPart = doc.AddMainDocumentPart();
mainPart.Document = new Document();
var body = new Body();
var paragraph = new Paragraph();
var run = new Run();
...
// append bold text
run.AppendChild(new RunProperties {Bold = new Bold(), });
run.AppendChild(new Text("some-text"));
...
// append red text
run.AppendChild(new RunProperties
{ Color = new Color {Val = "FF0000"}});
run.AppendChild(new Text("some-text"));
但我還沒有找到一種方法如何添加帶有彩色背景的文本。我怎樣才能做到這一點?