Word是我们日常生活、学习和工作中必不可少的文档处理工具。精致美观的文档能给人带来阅读时视觉上的美感。在本篇文章中,将介绍如何使用组件Free Spire.Doc for .NET(社区版)给Word设置文档背景。下面的示例中,给Word添加背景分为三种情况来讲述,即添加纯色背景,渐变色背景和图片背景。
工具使用:下载安装控件Free Spire.Doc后,在项目程序中添加Spire.Doc.dll即可(该dll可在安装文件下Bin文件夹中获取)
一、添加纯色背景
using Spire.Doc;
using System.Drawing;
namespace AddBackground
{
class Program
{
static void Main(string[] args)
{
//创建一个Document类对象,并加载Word文档
Document document = new Document();
document.LoadFromFile(@"C:\User