Aspose.Words是一款功能强大的Word处理控件,不需要安装Office的情况下,可以对word文档进行浏览,修改,保存,转换,支持DOC, DOT, DOCM, DOTM, DOCX, DOTX等格式,支持转换为word文档为 PDF, XPS, XamlFixed, XamlFlow, XamlFlowPack, EPUB, HTML, HtmlFixed, OpenXPS, PostScript, TXT 等,和 TIFF, JPG, PNG, BMP, SVG, EMF, SVG , SWF等图像文件.
如何使用Aspose.Words设置页面边距和页面背景色:
Document doc = new Document(@"test.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
PageSetup ps = builder.PageSetup;
ps.LeftMargin = ConvertUtil.InchToPoint(0.0);//设置或修改边距
builder.Document.PageColor = Color.YellowGreen;//设置背景色
builder.Document.Save(@"out.doc");