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

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 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
  • ¥15 算法题:数的划分,用记忆化DFS做WA求调