PageColor

DocumentBase.PageColor property

获取或设置文档的页面颜色。此属性是BackgroundShape.

public Color PageColor { get; set; }

评论

此属性提供了一种为文档指定纯色页面颜色的简单方法。 设置此属性可创建并设置适当的BackgroundShape

如果未设置页面颜色(例如文档中没有背景形状)返回 Empty。

例子

展示如何设置文档所有页面的背景颜色。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");

doc.PageColor = System.Drawing.Color.LightGray;

doc.Save(ArtifactsDir + "DocumentBase.SetPageColor.docx");

也可以看看