PDA

View Full Version : 如何把表单中域生成到本地计算机WORD表格中


vcvb998
17-09-06, 11:08 PM
1、如何处理文件折离到本地计算机上
2、在NOTOS中使用WORD宏
3、如何把表单中域生成到本地计算机WORD表格中

请各位朋友帮忙,在线等

空空空
18-09-06, 12:52 PM
1、如何处理文件折离到本地计算机上

查看一下 NotesEmbeddedObject类帮助,里面有个方法:Call notesEmbeddedObject.ExtractFile( path$ )

2、在NOTOS中使用WORD宏
这个没必要,Notes Script本身支持,查看OLE里的Office编程帮助,以及VBA(就是说宏相应功能代码都写在Notes里)

3、如何把表单中域生成到本地计算机WORD表格中

这个问题跟第二个差不多,都涉及到Notes对Office的编程,多找些例子,研究一下就可以了!
这个论坛里就有很多例子,仔细找一下!

vcvb998
18-09-06, 08:16 PM
楼主我是初学,能不能提供我代码,让我学习学习

whtportland
19-09-06, 02:16 PM
Sub Initialize
On Error Goto errproc
Dim session As New NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim doc As NotesDocument
Dim Wordapp As Variant
Dim WordSourceDoc As Variant

Set db=session.CurrentDatabase
Set vw=db.GetView("Vdxjl800")
Set doc=vw.GetFirstDocument

Set Wordapp=CreateObject("Word.Application")

'初始化Word文件
Call Wordapp.Documents.Add
Set WordSourceDoc=Wordapp.activedocument
Set selection=Wordapp.selection
Call WordSourceDoc.Tables.Add(Wordapp.selection.Range,25,3)

'表头
Call selection.TypeText("创建日期")
Call selection.MoveRight(12)
Call selection.TypeText("创建时间")
Call selection.MoveRight(12)
Call selection.TypeText("手机号码")
Call selection.MoveRight(12)

'从文档中读取数据写入表格中
If Not doc Is Nothing Then
Call selection.TypeText(Cstr(doc.displaydate(0)))
Call selection.MoveRight(12)
Call selection.TypeText(Cstr(doc.displaytime(0)))
Call selection.MoveRight(12)
Call selection.TypeText(Cstr(doc.PhoneNo(0)))
Call selection.MoveRight(12)
End If

'保存Word文件
Call WordSourceDoc.SaveAs("C:\短信记录.doc")

Exit Sub
errproc:
Msgbox "Error:"+Error$+" in Line:"+Cstr(Erl()) + " in Agent(PrintWord)"
End Sub