word 加水印C#

 
  1.  private void responsewrite()
  2.     {
  3.         StringBuilder strscript = new StringBuilder();
  4.         strscript.Append(" <script language =/"vbscript/">/r/n");
  5.         strscript.Append("Set myDocApp = CreateObject(/"Word.Application/")/r/n");
  6.         strscript.Append("myDocApp.Visible = True/r/n");
  7.         strscript.Append(" myDocApp.Activate/r/n");
  8.         strscript.Append("set myDoc = myDocApp.Documents.Open(/"http://localhost:1507/Web/AppModules/SPJG/Annex/00/2008/12/30/20081230144112380.doc/")/r/n");
  9.         strscript.Append("dim water/r/n");
  10.         strscript.Append("water = /"备案号:/" + chr(13) + /"Q3301Q807757-2005/" + chr(13) + /"有效期至/" + /"2008年10月22日/"/r/n");
  11.         strscript.Append("myDocApp.ActiveDocument.Shapes.AddTextbox(1, 63.85, 53.85, 265.85, 30).Select/r/n");
  12.         strscript.Append(" myDocApp.Selection.ShapeRange.TextFrame.TextRange.Select/r/n");
  13.         strscript.Append("myDocApp.Selection.Collapse/r/n");
  14.         strscript.Append(" myDocApp.Selection.TypeText(/"备案号:Q3301Q807757-2005/")/r/n");
  15.         strscript.Append("myDocApp.Selection.ShapeRange.Fill.Visible = True/r/n");
  16.         strscript.Append("myDocApp.Selection.ShapeRange.Fill.Solid/r/n");
  17.         strscript.Append("myDocApp.Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)/r/n");
  18.         strscript.Append("myDocApp.Selection.ShapeRange.Fill.Transparency = 1/r/n");
  19.         strscript.Append(" myDocApp.Selection.ShapeRange.Line.DashStyle = 1/r/n");
  20.         strscript.Append("myDocApp.Selection.ShapeRange.Line.Style = 1/r/n");
  21.         strscript.Append("myDocApp.Selection.ShapeRange.Line.Transparency = 0/r/n");
  22.         strscript.Append(" myDocApp.Selection.ShapeRange.Line.Visible = False/r/n");
  23.         strscript.Append(" myDocApp.ActiveDocument.Sections(1).Range.Select/r/n");
  24.         strscript.Append(" myDocApp.ActiveWindow.ActivePane.View.SeekView = 9 /r/n");
  25.         strscript.Append(" myDocApp.Selection.HeaderFooter.Shapes.AddTextEffect(msoTextEffect1, water, /"宋体/", 1, False, False, 0, 0).Select/r/n");
  26.         strscript.Append(" myDocApp.Selection.ShapeRange.Name = /"msoTextEffect1/"/r/n");
  27.         strscript.Append(" myDocApp.Selection.ShapeRange.TextEffect.NormalizedHeight = False/r/n");
  28.         strscript.Append(" myDocApp.Selection.ShapeRange.TextEffect.FontBold = True/r/n");
  29.         strscript.Append(" myDocApp.Selection.ShapeRange.Line.Visible = False/r/n");
  30.         strscript.Append(" myDocApp.Selection.ShapeRange.Fill.Visible = True/r/n");
  31.         strscript.Append("myDocApp.Selection.ShapeRange.Fill.Solid/r/n");
  32.         strscript.Append(" myDocApp.Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 25, 100)/r/n");
  33.         strscript.Append(" myDocApp.Selection.ShapeRange.Fill.Transparency = 0 /r/n");
  34.         strscript.Append("myDocApp.Selection.ShapeRange.Rotation = 355 /r/n");
  35.         strscript.Append(" myDocApp.Selection.ShapeRange.LockAspectRatio = True/r/n");
  36.         strscript.Append(" myDocApp.Selection.ShapeRange.Height = 50 /r/n");
  37.         strscript.Append(" myDocApp.Selection.ShapeRange.Width = 300 /r/n");
  38.         strscript.Append(" myDocApp.Selection.ShapeRange.WrapFormat.AllowOverlap = True/r/n");
  39.         strscript.Append("  myDocApp.Selection.ShapeRange.WrapFormat.Side = 3 /r/n");
  40.         strscript.Append("  myDocApp.Selection.ShapeRange.WrapFormat.Type = 3/r/n");
  41.         strscript.Append(" myDocApp.Selection.ShapeRange.RelativeHorizontalPosition = 0 /r/n");
  42.         strscript.Append("  myDocApp.Selection.ShapeRange.RelativeVerticalPosition = 0/r/n");
  43.         strscript.Append("  myDocApp.Selection.ShapeRange.Left = 70  /r/n");
  44.         strscript.Append("  myDocApp.Selection.ShapeRange.Top = 190 /r/n");
  45.         strscript.Append("  myDocApp.ActiveWindow.ActivePane.View.SeekView = 0 /r/n");
  46.         strscript.Append(" function cancel()/r/n");
  47.         strscript.Append("On Error Resume Next/r/n");
  48.         strscript.Append(" myDocApp.Quit()/r/n");
  49.         strscript.Append(" self.close()/r/n");
  50.         strscript.Append(" end function/r/n");
  51.         strscript.Append("</script>");
  52.         Response.Write(strscript);
  53.     }
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值