VB6中,过程如下:
Set oApp = New Word.Application
Set oDoc = Documents.Open(c:\text.doc)
With oDoc
oDoc.Sections(1).Range.Select
oDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddTextEffect([glow=255,red,2]PowerPlusWaterMarkObject1[/glow], _
"水印文字", "宋体"1, False, False, 0, 0).Select '提示在"PowerPlusWaterMarkObject1"处出错
Selection.ShapeRange.Name = "PowerPlusWaterMarkObject1"
Selection.ShapeRange.TextEffect.NormalizedHeight = False
Selection.ShapeRange.Line.Visible = False
Selection.ShapeRange.Fill.Visible = True
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(204, 153, 255)
Selection.ShapeRange.Fill.Transparency = 0.5
Selection.ShapeRange.Rotation = 315
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(5.99)
Selection.ShapeRange.Width = CentimetersToPoints(17.97)
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 3
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = wdShapeCenter
Selection.ShapeRange.Top = wdShapeCenter
oDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
.Save
.Close
End With
End Sub
[此贴子已经被作者于2006-1-26 22:52:27编辑过] |