开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 1145|回复: 3
收起左侧

[易语言] 关于添加word水印

[复制链接]
结帖率:14% (1/7)
发表于 2021-6-21 11:48:27 | 显示全部楼层 |阅读模式   辽宁省大连市
10精币
添加水印:
ActiveDocument.Sections(1).Range.Select
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.HeaderFooter.Shapes.AddTextEffect(PowerPlusWaterMarkObject906303 _
        , "11保密", "宋体", 1, False, False, 0, 0).Select
    Selection.ShapeRange.Name = "PowerPlusWaterMarkObject906303"
    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(192, 192, 192)
    Selection.ShapeRange.Fill.Transparency = 0.5
    Selection.ShapeRange.Rotation = 315
    Selection.ShapeRange.LockAspectRatio = True
    Selection.ShapeRange.Height = CentimetersToPoints(7.4)
    Selection.ShapeRange.Width = CentimetersToPoints(22.2)
    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

插入水印:
With ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range, FileName:= _
        "C:\Users\admin\Pictures\2017-11-12\OCR.BMP", LinkToFile:=False, _
        SaveWithDocument:=True)
        .WrapFormat.Type = 3
        .ZOrder 4
    End With

求转易代码!


回答提醒:如果本帖被关闭无法回复,您有更好的答案帮助楼主解决,请发表至 源码区 可获得加分喔。
友情提醒:本版被采纳的主题可在 申请荣誉值 页面申请荣誉值,获得 1点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
快捷通道:申请荣誉值无答案申请取消悬赏投诉有答案未采纳为最佳

结帖率:100% (2/2)
发表于 2021-6-21 12:25:49 | 显示全部楼层   内蒙古自治区通辽市
  
子程序名返回值类型公开备 注
_按钮1_被单击  
变量名类 型静态数组备 注
局_文件名文本型 
局_Word对象对象 
局_Documents对象对象 
局_Document对象对象 
局_Window对象对象 
局_Shapes对象对象 
如果真 (打开文件通用对话框.打开 ())
返回 ()
局_文件名 = 打开文件通用对话框.文件名
局_Word对象.创建 (“Word.Application”, )
局_Word对象.写属性 (“Visible”, )
局_Documents对象 = 局_Word对象.读对象型属性 (“Documents”, )
局_Document对象 = 局_Documents对象.对象型方法 (“Open”, 打开文件通用对话框.文件名)
局_Window对象 = 局_Word对象.读对象型属性 (“ActiveWindow”, )
局_Shapes对象 = 局_Document对象.读对象型属性 (“Shapes”, )
局_Shapes对象.对象型方法 (“AddPicture”, 取运行目录 ()“\Demo.jpg”, , , 150, 150, 320, 320, )
局_Document对象.方法 (“Save”, )
局_Documents对象.方法 (“Close”, )
局_Word对象.方法 (“Quit”, )
局_Window对象.清除 ()
局_Document对象.清除 ()
局_Documents对象.清除 ()
局_Word对象.清除 ()
回复

使用道具 举报

结帖率:14% (1/7)

签到天数: 1 天

 楼主| 发表于 2021-6-21 17:21:20 | 显示全部楼层   辽宁省大连市

是加文字水印那种,在文档底部的,不过还是谢谢你!
回复

使用道具 举报

结帖率:73% (43/59)

签到天数: 10 天

发表于 2023-8-1 11:41:15 | 显示全部楼层   广东省梅州市
.版本 2

局_word对象.获取 (“word.Application”)
' ActiveDocument.Sections(1).Range.Select

局_ActiveDocument = 局_word对象.读对象型属性 (“ActiveDocument”, )

' 局_Sections = 局_ActiveDocument.读对象型属性 (“Sections”, )

' 局_Sections.读对象型属性 (“Item”, 1).读对象型属性 (“Range”, ).方法 (“Select”, )

' ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
局_word对象.读对象型属性 (“ActiveWindow”, ).读对象型属性 (“ActivePane”, ).读对象型属性 (“View”, ).写属性 (“SeekView”, 9)  ' #wdSeekCurrentPageHeader的值=9

局_Selection = 局_word对象.读对象型属性 (“Selection”, )
局_Sections.读对象型属性 (“HeaderFooter”, ).读对象型属性 (“Shapes”, ).对象型方法 (“PowerPlusWaterMarkObject8163454”, ).方法 (“Select”, )
局_Sections.写属性 (“Delete”, )

' Selection.HeaderFooter.Shapes.AddTextEffect( _
' PowerPlusWaterMarkObject8163454, "保密1", "等线", 1, False, False, 0, 0). _Select
局_Selection.读对象型属性 (“HeaderFooter”, ).读对象型属性 (“Shapes”, ).对象型方法 (“AddTextEffect”, 0, “保密1”, “等线”, 1, 真, 假, 0, 0).方法 (“Select”, )

局_ShapeRange = 局_Selection.读对象型属性 (“ShapeRange”, )
' Selection.ShapeRange.Name = "PowerPlusWaterMarkObject8163454"
局_ShapeRange.写属性 (“Name”, “PowerPlusWaterMarkObject8163454”)
' Selection.ShapeRange.TextEffect.NormalizedHeight = False
局_ShapeRange.读对象型属性 (“TextEffect”, ).写属性 (“NormalizedHeight”, 假)
' Selection.ShapeRange.Line.Visible = False
局_ShapeRange.读对象型属性 (“Line”, ).写属性 (“Visible”, 假)
' Selection.ShapeRange.Fill.Visible = True
局_ShapeRange.读对象型属性 (“Fill”, ).写属性 (“Visible”, 真)
' Selection.ShapeRange.Fill.Solid
局_ShapeRange.读对象型属性 (“Fill”, ).方法 (“Solid”, )
' Selection.ShapeRange.Fill.ForeColor.RGB = RGB(192, 192, 192)
局_ShapeRange.读对象型属性 (“Fill”, ).读对象型属性 (“ForeColor”, ).写属性 (“RGB”, 取颜色值 (192, 192, 192))
' Selection.ShapeRange.Fill.Transparency = 0.5
局_ShapeRange.读对象型属性 (“Fill”, ).写属性 (“Transparency”, 0.5)
' Selection.ShapeRange.Rotation = 315
局_ShapeRange.写属性 (“Rotation”, 315)
' Selection.ShapeRange.LockAspectRatio = True
局_ShapeRange.写属性 (“LockAspectRatio”, 真)
' Selection.ShapeRange.Height = CentimetersToPoints(5.9)
局_ShapeRange.写属性 (“Height”, 局_word对象.数值方法 (“CentimetersToPoints”, 5.9))
' Selection.ShapeRange.Width = CentimetersToPoints(14.75)
局_ShapeRange.写属性 (“Width”, 局_word对象.数值方法 (“CentimetersToPoints”, 14.75))
' Selection.ShapeRange.WrapFormat.AllowOverlap = True
局_ShapeRange.读对象型属性 (“WrapFormat”, ).写属性 (“AllowOverlap”, 真)
' Selection.ShapeRange.WrapFormat.Side = wdWrapNone
局_ShapeRange.读对象型属性 (“WrapFormat”, ).写属性 (“Side”, 3)  ' #wdWrapNone的值=3
' Selection.ShapeRange.WrapFormat.Type = 3
局_ShapeRange.读对象型属性 (“WrapFormat”, ).写属性 (“Type”, 3)
' Selection.ShapeRange.RelativeHorizontalPosition = _
' wdRelativeVerticalPositionMargin
局_ShapeRange.写属性 (“RelativeHorizontalPosition”, 0)  ' wdRelativeVerticalPositionMargin的值=0
' Selection.ShapeRange.RelativeVerticalPosition = _
' wdRelativeVerticalPositionMargin
局_ShapeRange.写属性 (“RelativeVerticalPosition”, 0)  ' wdRelativeVerticalPositionMargin的值=0
' Selection.ShapeRange.Left = wdShapeCenter
局_ShapeRange.写属性 (“Left”, #wdShapeCenter)  ' wdShapeCenter的值=-999995
' Selection.ShapeRange.Top = wdShapeCenter
局_ShapeRange.写属性 (“Top”, #wdShapeCenter)  ' wdShapeCenter的值=-999995
' ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
局_word对象.读对象型属性 (“ActiveWindow”, ).读对象型属性 (“ActivePane”, ).读对象型属性 (“View”, ).写属性 (“SeekView”, 0)  ' #wdSeekMainDocument的值=0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表