/**/
///初始化文档对象
Word.Document WordDoc
=
wordAppObj.Documents.Open(
ref
_filename,
ref
missing,
ref
isReadOnly,
ref
missing,
ref
missing,
ref
missing,
ref
missing,
ref
missing,
ref
missing,
ref
missing,
ref
missing,
ref
isVisible,
ref
missing,
ref
missing,
ref
missing,
ref
missing);
/**/
///根据文档对象的高度与宽度生成文档背景的图片
string
bkpic
=
CreateBackGroup(WordDoc.ActiveWindow.Height, WordDoc.ActiveWindow.Width, picFilePath);
Word.Shape oShape;
/**/
///创建背景水印图征
WordDoc.ActiveWindow.View.Type
=
Word.WdViewType.wdOutlineView;
WordDoc.ActiveWindow.View.SeekView
=
Word.WdSeekView.wdSeekPrimaryHeader;
WordDoc.ActiveWindow.ActivePane.Selection.InsertAfter(
“”
);
object
top
=
30
;
/**/
///将背景水印图片插入到Word
oShape
=
WordDoc.ActiveWindow.ActivePane.Selection.HeaderFooter.Shapes.AddPicture(bkpic,
ref
missing,
ref
missing,
ref
missing,
ref
top,
ref
missing,
ref
missing,
ref
missing);
oShape.WrapFormat.Type
=
Word.WdWrapType.wdWrapInline;
oShape.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBehindText);
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/111116.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...