将文档中的信息导出excel中,使用代理简介
1.首先选择要导出那些文档中的明细 即选择notesdocumentcollection
Call getdc(db,doc,dc) '获取符合查询条件的文档集合
---getdc函数介绍:使用notesdatabase中的search方法
语法:
Set notesDocumentCollection = notesDatabase.Search( formula$, notesDateTime, maxDocs% )
参数说明:
formula$:指定选择条件的公式
notesDateTime: Specify Nothing to indicate no cutoff date.
maxDocs%:Specify 0 to receive all matching documents.
如:Set dc = db.Search(SearchStr,Nothing,0)
2.导出明细之function:Function Excelpreout(db As NotesDatabase,curdoc As NotesDocument,dc As NotesDocumentCollection)
If dc.Count>0 Then
Call Excelpreout(db,doc,dc) '导出明细
End If
分析:
Set doc = db.GetProfileDocument("(excel model)") --获取profiledocument (excel model)为表单名字
mulu="d:lotusdominoDatadominoiconsoffice2000"+"Back_Scrap_Report.xls" --服务器上存放xecel模板的路径
If mulu="" Then
Msgbox "没有输入拆离路径!",,"拆离"
Exit Function
dim rtitem as variant
Set rtitem = doc.GetFirstItem( "excel" ) --获取forfile文档中excel域,此域类型为富文本类型
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects --获取excel域中存储的对象
Call o.ExtractFile(mulu) --ExtractFile:Writes a file attachment to storage.
End Forall
End If
Set obj = CreateObject("Excel.Application") --创建excel应用程序
obj.Visible =False
obj.Workbooks.Open mulu ---打开指定目录下的工作薄
obj.Worksheets("Sheet1").Range("A"+Cstr(i)).Formula ="退港物料(S1倉庫)" --向excel中添加内容
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
obj.ActiveWorkbook.Save --保存
obj.Workbooks.close --关闭
Set obj=Nothing --将obj对象清空
Print {<script language="JavaScript" type="text/JavaScript">window.open('/icons/office2000/Back_Scrap_Report.xls','_bank','')</script>}
Print {<script language="JavaScript" type="text/JavaScript">window.history.back();</script>} //返回上一层
说明:<script type="text/javascript">表示在<script></script>之间的是文本类型(text)。javascript是为了告诉浏览器里面的文本是属于javascript脚本。
添加新评论0 条评论