本文介绍了水印Awalys应用于奇数页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过在标题中添加形状对象,将WordArt"水印"应用于许多文档。
但是对于奇数/偶数页眉不同的文档,水印只会应用于奇数页眉...即使我使用'Section.Headers [Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages]'来指定偶数页眉!
无论我尝试什么,我都无法将水印应用于奇数/偶数页面标题设置不同的文档上的偶数页面。
我的代码:
I'm applying a WordArt 'Watermark' to many documents by adding a shape object to the header.
However for documents where odd/even page headers are different, the Watermark only gets applied to the odd page headers... even when I use 'Section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages]' to specify the even page headers!
No matter what I try, I can't get the Watermark applied to even pages on documents where odd/even page headers are set to be different.
My code:
object fileName = docPath;
Word.Document nDoc = nWord.Documents.Open(ref fileName, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Word.Shape nShape = null;
foreach (Word.Section section in nDoc.Sections)
{
nShape = section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages].Shapes.AddTextEffect(Microsoft.Office.Core.MsoPresetTextEffect.msoTextEffect1, wmText, "Arial", (float)36, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, 0, 0, ref oMissing);
nShape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
nShape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
nShape.Fill.Solid();
nShape.Fill.ForeColor.RGB = (Int32)Word.WdColor.wdColorGray20;
nShape.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionMargin;
nShape.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionMargin;
nShape.Left = (float)Word.WdShapePosition.wdShapeCenter;
nShape.Top = (float)Word.WdShapePosition.wdShapeCenter;
}
nDoc.Close(ref saveChanges, ref oMissing, ref oMissing);
推荐答案
这篇关于水印Awalys应用于奇数页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!