BS模式下,我用模板的方式将表单的内容输出到word打印,只是我一点击怎么不在客户端上打开word,却在服务器上打开word?
代码如下:
Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim doc As notesdocument
Dim docsj As notesdocument
dbname=Evaluate("@dbname")
Set db=New notesdatabase(dbname(0),"meritoa\merit_sjzd.nsf") '//取到数据字典
Set view=db.getview("moban")
Set docsj=view.getfirstdocument()
Set doc=session.documentcontext()
Set item=docsj.getfirstitem("FldTemplate")
If ( item.Type = RICHTEXT ) Then
Set object = item.getEmbeddedObject(item.EmbeddedObjects(0).name)
object.Extractfile("c:\月度计划汇总表.doc")
End If
Set wordapp=createobject("word.application")
wordapp.visible=True
wordapp.documents.open("c:\月度计划汇总表.doc") '//获得word模板
wordapp.activedocument.bookmarks("huizongren").select
wordapp.wordbasic.insert(doc.planman(0))
wordapp.activedocument.bookmarks("yuefen").select
wordapp.wordbasic.insert(doc.planmonth(0))
wordapp.activedocument.bookmarks("huizongriqi").select
wordapp.wordbasic.insert(doc.formdate(0))
wordapp.activedocument.bookmarks("start").select
For i=1 To 10
deptname=doc.getitemvalue("depname"+Cstr(i))(0)
If deptname<>"" Then
wordapp.wordbasic.insert(deptname)
wordapp.Selection.ParagraphFormat.Alignment=1
wordapp.Selection.Range.Cells.VerticalAlignment = 1
wordapp.selection.moveright(12)
item=doc.getitemvalue("workplan"+Cstr(i))
j=0
Forall o In item
j=j+1
End Forall
wordapp.Selection.Cells.Split(j)
wordapp.Selection.Moveup
Forall o In item
wordapp.Selection.MoveDown
wordapp.wordbasic.insert(o)
End Forall
wordapp.selection.moveright(12)
item=doc.getitemvalue("over"+Cstr(i))
wordapp.Selection.Cells.Split(j)
wordapp.Selection.Moveup
Forall o In item
wordapp.Selection.MoveDown
wordapp.wordbasic.insert(o)
End Forall
wordapp.selection.moveright(12)
item=doc.getitemvalue("duty"+Cstr(i))
wordapp.Selection.Cells.Split(j)
wordapp.Selection.Moveup
Forall o In item
wordapp.Selection.MoveDown
wordapp.wordbasic.insert(o)
End Forall
wordapp.selection.moveright(12)
item=doc.getitemvalue("charger"+Cstr(i))
wordapp.Selection.Cells.Split(j)
wordapp.Selection.Moveup
Forall o In item
wordapp.Selection.MoveDown
wordapp.wordbasic.insert(o)
End Forall
wordapp.selection.moveright(12)
item=doc.getitemvalue("xtbumen"+Cstr(i))
wordapp.Selection.Cells.Split(j)
wordapp.Selection.Moveup
For k=0 To j-1
wordapp.Selection.MoveDown
Next
wordapp.selection.moveright(12)
Else
continue=False
'wordapp.Selection.Rows.Delete
End If
Next
End Sub
请大虾们指点指点!小弟先谢过了.