以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  打印水印的代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=66914)

--  作者:yjd
--  发布时间:2015/4/15 20:30:00
--  打印水印的代码
版主,我想通过模板打印报表,同时加入水印,您看代码需要怎么写!谢谢!

Dim Book As New XLS.Book(ProjectPath & "Attachments\\客户档案.xls") \'打开模板
Dim fl As String = ProjectPath & "Reports\\客户档案.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim doc As New PrintDoc
Dim rt As New prt.RenderText
doc.body.Children.Add(rt)
rt = New prt.RenderText \'设置文本对象的内容
rt.Text= "制表:" & User.Name 
rt.Width = "Parent.Width" \'宽度等于页面宽度
rt.Height = "Parent.Height" \'高度等于页面高度
rt.Style.TextAngle = 45 \'旋转45度
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中对齐
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中对齐
rt.Style.FontSize = 72 \'字体大小为8磅
rt.Style.TextColor = Color.Gray \'文本颜色为灰色
Doc.WaterMark = rt \'作为页眉使用
Sheet(3,0).Value = "<客户明细, 1>"  \'细节区定义一
Sheet(12,0).Value = "<客户明细>"  \'细节区定义二
Sheet(2,4).Value = "数据日期:"& Date.Today()
Sheet(2,5).Value = "制表:" & User.Name \'修改模板,加入制单人信息
Book.Build() \'生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()

--  作者:有点酸
--  发布时间:2015/4/15 21:12:00
--  
二者风马牛不相及,哪能混在一起用? 设计模版的时候,给模版马上水印,或者完全用专业报表实现!