与windows上的主要区别是AddTextEffect的方法参数,布尔值用0或1来代替
function addWaterMark(text)
{
try
{
var ActiveDocument = oframe.ActiveDocument;
for (i=1;i<=ActiveDocument.Sections.Count ; i++){
ActiveDocument.Sections.item(i).Range.Select();
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = 9; //wdSeekCurrentPageHeader
var Selection = ActiveDocument.Application.Selection;
Selection.HeaderFooter.Shapes.AddTextEffect(0, text, "宋体", 1, 0, 0, 0, 0).Select();
Selection.ShapeRange.TextEffect.NormalizedHeight = false;
Selection.ShapeRange.Line.Visible = false;
Selection.ShapeRange.Fill.Visible = true;
Selection.ShapeRange.Fill.Solid();
Selection.ShapeRange.Fill.ForeColor.RGB = 12345;
Selection.ShapeRange.Fill.Transparency = 0.5;
Selection.ShapeRange.Rotation = 315;
Selection.ShapeRange.LockAspectRatio = true;
Selection.ShapeRange.Height = ActiveDocument.Application.CentimetersToPoints(4.13);
Selection.ShapeRange.Width = ActiveDocument.Application.CentimetersToPoints(16.52);
Selection.ShapeRange.WrapFormat.AllowOverlap = true;
Selection.ShapeRange.WrapFormat.Side = 3;//wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 3;
Selection.ShapeRange.RelativeHorizontalPosition = 0;//wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = 0; //wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = -999995; //wdShapeCenter
Selection.ShapeRange.Top = -999995; //wdShapeCenter
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = 0;//wdSeekMainDocument
}
}
catch(err){
alert("addWaterMark errir:" + err.number + ":" + err.description);
}
}
|
|