怎样将notes导入excel中?
上次问过怎样将excel导入notes,现在我想问怎样将notes导入excel中,有没有代码可供参考?谢谢了! 问题点数:50、回复次数:9Top
1 楼loadagain(最后一只妖怪)回复于 2005-08-02 23:38:33 得分 15
dim s as new notesSession
dim db as notesDatabase
dim docs as notesDocumentcollection
dim doc as notesdocument
dim xlsApp
set db=s.currentdatabase
set docs=db.unprocesseddocuments
set xlsApp=createobject("excel.application")
xlsApp.workbooks.add
xlsApp.visible=true
for i=1 to docs.count
set doc=docs.getnthdocument(i)
xlsApp.cells(i,1)=doc.subject(0)
next i
set xlsApp=nothing
set doc=nothing
set docs=nothing
set db=nothing
set s=nothingTop
2 楼CrazyNotes(疯狂的人)回复于 2005-08-03 09:19:51 得分 5
如果你是web应用的话,你可以参考一下owc。也就是office web components。Top
3 楼xjunhua(沉思的森林)回复于 2005-08-03 09:28:11 得分 30
再贴一个
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim curdoc As NotesDocument
Set uidoc = ws.CurrentDocument
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim session As New NotesSession
Dim excelApplication As Variant
Dim excelWorkbook As Variant
Dim excelSheet As Variant
Dim collection As notesdocumentcollection
Dim i,index1,index2 As Integer
filenames = ws.SaveFileDialog(False,"导出到Excel",, "D:\", "assets.xls")
If Isempty(filenames) Then Exit Sub
Set excelApplication = CreateObject("Excel.Application")
excelApplication.Visible = True
Set excelWorkbook = excelApplication.Workbooks.Add
Set excelSheet = excelWorkbook.Worksheets("Sheet1")
'根据选中要导出的字段来设置excle的第一列
excelSheet.Cells(1,1).Value = "资产编号"
excelSheet.Cells(1,2).Value = "资产名称"
excelSheet.Cells(1,3).Value = "规格型号"
excelSheet.Cells(1,4).Value = "具体配置"
excelSheet.Cells(1,5).Value = "使用部门"
excelSheet.Cells(1,6).Value = "责任人"
i = 2
Set db = session.CurrentDatabase
'如果直接从当前视图导出
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()
If (doc Is Nothing) Then Messagebox("请选择你要导出的记录!")
While Not(doc Is Nothing)
excelSheet.Cells(i,1).Value = doc.NumberID(0)
excelSheet.Cells(i,2).Value = doc.pc(0)
excelSheet.Cells(i,3).Value = doc.Brand(0)+" "+doc.Type1(0)
excelSheet.Cells(i,4).Value = ""
excelSheet.Cells(i,5).Value = doc.BU(0)+"/"+doc.CDep(0)
excelSheet.Cells(i,6).Value = doc.owner(0)
Set doc = collection.GetNextDocument(doc)
'Set doc = view.GetNextDocument(doc)
Wend
excelWorkbook.SaveAs(filenames(0))
excelApplication.Quit
Set excelApplication = Nothing
'Call uidoc.Close()
End SubTop
4 楼glassch(:雪融:)回复于 2005-08-03 11:48:09 得分 0
同意,同意,Top
5 楼Spring1981(飞天侠)回复于 2005-08-04 10:36:11 得分 0
看不懂,学习中...........Top
6 楼youyiyang(oh,lotus)回复于 2005-08-07 22:29:18 得分 0
To xjunhua(沉思的森林),你好:
怎样将RTF域上的文字内容导入到EXCEL中去?Top
7 楼kingchang2000(骠骑大将)回复于 2005-08-08 10:05:12 得分 0
...
代码都有了,还不会吗?Top
8 楼youyiyang(oh,lotus)回复于 2005-08-08 22:07:39 得分 0
代码都有了,我也试过了,可以用。
代码我是读懂了。我现在的问题是,在表单上有一个RTF域, 我想将此RTF域中的文字导入excel的cell中去,源代码会报错,“variant does not contain a container”,然后程序就停在那儿了。我试过NotesRichTextItem的GetFormattedText方法和NotesItem的text属性,但还有问题。
请问该怎么写可以做到这一点呢?Top
9 楼xjunhua(沉思的森林)回复于 2005-08-08 22:35:15 得分 0
直接 doc.item 就可以了Top




