壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1307|回复: 7

[Domino C/S开发] 请大家说说notes------------>excel,word的思路!

[复制链接]
发表于 2003/9/26 14:18:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
如何把notes数据导入到excel?
发表于 2003/9/27 08:36:18 | 显示全部楼层
导入excel:可以考虑用视图把数据显示出来,然后用“文件”-> “引出” 变成*.wk4类型的文件,在excel中打开该文件就可以了。打开后需要在excel稍微编辑一下。^_^
      excel->notes和上面的步骤相反。
      用VBA可以编程实现自动转换,你可以查相关资料。
发表于 2003/9/27 10:04:28 | 显示全部楼层
前面一位斑竹发过的,现在重发给你参考。

NOTES<--------------->EXCEL 转换源码
1.notes--->excel:++++++++++++++++++++++

Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As Notesview
Dim doc As Notesdocument.nbsp
Dim excelapplication As Variant
Dim excelworkbook As Variant
Dim excelsheet As Variant
Dim i As Integer
Dim uvcols As Integer
Dim selection As Variant
&#39;path=session.GetEnvironmentString ("D:",True)
&#39;gzpath=path+"\"+"test.xls"
Set excelapplication=CreateObject("Excel.Application")
excelapplication.statusbar="正在创建工作表,请稍等....."
excelapplication.Visible=True
&#39;==================
&#39;excelapplication.excel.open(gzpath)
excelapplication.Workbooks.Add
excelapplication.referencestyle=2
Set excelsheet=excelapplication.Workbooks(1).worksheets(1)
excelsheet.name="notes export"
Dim rows As Integer
Dim cols As Integer
Dim maxcols As Integer
Dim fieldname As String
Dim fitem As NotesItem
rows=1
cols=1
Set db=session.CurrentDatabase
Set view=db.GetView ("注册表视图")
uvcols=Ubound(view.Columns)
For x=0 To Ubound(view.Columns)
excelapplication.statusbar="正在创建单元格,请稍等....."
If view.Columns(x).IsHidden=False Then
If view.Columns(x).title<>"" Then
&#39;excelsheet.Cells(1,1).value="姓名"
&#39;excelsheet.Cells(1,2).value="年龄"
excelsheet.Cells(rows,cols).value=view.Columns(x).Title
cols=cols+1
End If
End If
Next
maxcols=cols-1
Set doc=view.GetFirstdocument.nbsp
rows=2
cols=1
While Not(doc Is Nothing)
For x=0 To Ubound(view.Columns)
excelapplication.statusbar="正在从Notes中引入数据,请稍等....."
If view.Columns(x).IsHidden=False Then
If view.Columns(x).title<>"" Then
fieldname=view.Columns(x).itemname
Set fitem=doc.GetFirstItem(fieldname)
excelsheet.Cells(rows,cols).value=fitem.Text
cols=cols+1
End If
End If
Next
rows=rows+1
cols=1
Set doc=view.GetNextdocument.nbsp(doc)
Wend
With excelapplication.worksheets(1)
.pagesetup.orientation=2
.pagesetup.centerheader="report_confidential"
.pagesetup.rightfooter="page &P"&Chr$(13) &"Date:&D"
.pagesetup.CenterFooter=""
End With
excelapplication.referencestyle=1
excelapplication.range("A1").Select
excelapplication.statusbar="数据导入完成。"
excelsheet.PageSetup.PrintGridlines=True
&#39;excelworkbook.printout
&#39;excelworkbook.SaveAs("d:\test.xls")
&#39;excelworkbook.Save
excelapplication.Quit
Set excelapplication=Nothing
End Sub


2.excel-->notes++++++++++++++++++++++

Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim item As NotesItem
Dim files As Variant
Dim schar As String
Dim excelApplication As Variant
Dim excelWorkbook As Variant
Dim excelsheet As Variant
Dim i As Integer
Set db = session.CurrentDatabase
Set view = db.GetView( "ExcelRegister" )
files=workspace.OpenFileDialog (False,"选择引入数据文件","Excel file|*.xls","c:")
If files(0)="" Then
Exit Sub
Else
Set excelApplication=CreateObject("Excel.Application")
Set excelWorkbook =excelApplication.Workbooks.Open(files)
Set excelsheet=excelWorkbook.Worksheets(1)
i=2
stemp=excelSheet.Cells(i,1).value
Do Until Cstr(stemp)=""
Set cpdoc=New Notesdocument.db)
cpdoc.form="Excel_notes注册表"
cpdoc.lx=excelsheet.Cells(i,1).value
stemp=excelSheet.Cells(i,1).value
stemp2=excelSheet.Cells(i,2).value
cpdoc.NameExcel=stemp
cpdoc.AgeExcel=stemp2
i=i+1
Call cpdoc.save(True,False)
Call workspace.ViewRefresh
Loop
excelWorkbook.close(False)
excelApplication.Quit
Set excelApplication=Nothing
End If
End Sub
发表于 2003/10/5 13:04:57 | 显示全部楼层
谢谢楼上的两位
发表于 2005/3/24 15:54:50 | 显示全部楼层
感谢!
发表于 2005/4/6 15:28:12 | 显示全部楼层
那将excel 导入notes的方法呢???




发表于 2005/4/14 13:46:26 | 显示全部楼层
我试了上面的代码,可为什么看不到效果呢?
发表于 2005/4/23 18:03:51 | 显示全部楼层
现在有效果也现在,可怎样让它显示成一张完整的表格呢?
谢谢~`~``~~~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 06:12 , Processed in 0.014109 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表