dianchanzhou8768 2017-12-27 11:43 采纳率: 0%
浏览 2194
已结题

C++操纵Word文档,怎么添加水印

请问有谁知道怎么用C++给一个word文档添加水印嘛?
我看VBA宏的做法是在HeaderFooter的属性Shapse中使用方法AddPicture,
但把这段VBA宏转成C++语言就不知道怎么写了,
不知道里面的参数怎么填写,求大佬告诉!

VBA宏代码如下——
Sub 宏1()
'
' 宏1 宏
'
'
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(FileName:= _
"C:\Users\Administrator\Pictures\2016-10-30\001.jpg", LinkToFile:=False, _
SaveWithDocument:=True).Select
Selection.ShapeRange.Name = "WordPictureWatermark196080593"
Selection.ShapeRange.PictureFormat.Brightness = 0.85
Selection.ShapeRange.PictureFormat.Contrast = 0.15
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(21.44)
Selection.ShapeRange.Width = CentimetersToPoints(14.65)
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
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

  • 写回答

3条回答

  • L01997 2017-12-27 12:59
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64