星空最火知名网站

logo Aspose中文文档

添加页眉和页脚


Aspose.Words是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。

Aspose API支持流行文件格式处理,并允许将各类文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。

Aspose.Words for .NET 最新下载

VSTO

Word.Application wordApp = Application;
wordApp.Documents.Open("Add Headers and Footers.doc");
//Add Header
foreach (Word.Section section in this.Application.ActiveDocument.Sections)
{
Word.Range headerRange = section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
headerRange.Fields.Add(headerRange, Word.WdFieldType.wdFieldPage);
headerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
}
//Add Footer
foreach (Word.Section wordSection in this.Application.ActiveDocument.Sections)
{
Word.Range footerRange = wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
footerRange.Font.ColorIndex = Word.WdColorIndex.wdDarkRed;
footerRange.Font.Size = 20;
footerRange.Text = "Confidential";
}

点击复制

Aspose.Words

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create the headers.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Header Text goes here...");
//add footer having current date
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.InsertField("Date", "");
doc.UpdateFields();
doc.Save("Insert Headers and Footers.doc");

点击复制

下载示例代码

  •  
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP
PM娱乐城真人滚球官方(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 雷火竞技最新现金(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 十大正规PM娱乐城网址(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 十大利记足球大全(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 靠谱永利(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 知名雷火竞技官方(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 半岛网上权威直营(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 博鱼网上外围网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新)