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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2356|回复: 3

[Lotus原码学习] [原创]SCRIPT中如何将视图的数据导入EXCEL

[复制链接]
发表于 2005/3/6 07:09:35 | 显示全部楼层 |阅读模式

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

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

x
Sub Click(Source As Button)
Print "Please Wait.....Running MSExcel report"
Dim session As New NotesSession
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim handle As Variant
Dim db As NotesDatabase
Dim view As NotesView
Dim counter As Integer
counter3 = 0
counter4 = 0
counter5 = 0
counter6 = 0
counter7 = 0
yescounter3 = 0
yescounter4 = 0
yescounter5 = 0
yescounter6 = 0
yescounter7 = 0
Set db = session.CurrentDatabase
Set view = db.GetView( "StateReport" )
Set doc2 = view.GetFirstDocument
' Forall c In view.Columns
' Messagebox( c.Position & " " & c.Title )
' End Forall
Columnname3 =view.Columns(3).Title
Columnname4 =view.Columns(4).Title
Columnname5 =view.Columns(5).Title
Columnname6 =view.Columns(6).Title
Columnname7 =view.Columns(7).Title
While Not ( doc2 Is Nothing )
vtitle5 = doc2.ColumnValues( 3 )
vNSR = doc2.ColumnValues( 4 )
vPSD = doc2.ColumnValues( 5 )
vUtil = doc2.ColumnValues( 6 )
vTier2 = doc2.ColumnValues( 7 )
If vtitle5 = "No" Then
counter3 = counter3 + 1
Else
If vtitle5 = "Yes" Then
yescounter3 = yescounter3 + 1
End If
End If
If vNSR = "No" Then
counter4 = counter4 + 1
Else
If vNSR = "Yes" Then
yescounter4 = yescounter4 + 1
End If
End If
If vPSD = "No" Then
counter5 = counter5 + 1
Else
If vPSD = "Yes" Then
yescounter5 = yescounter5 + 1
End If
End If
If vUtil = "No" Then
counter6 = counter6 + 1
Else
If vUtil = "Yes" Then
yescounter6 = yescounter6 + 1
End If
End If
If vTier2 = "No" Then
counter7 = counter7 + 1
Else
If vTier2 = "Yes" Then
yescounter7 = yescounter7 + 1
End If
End If
Set doc2 = view.GetNextDocument( doc2 )
Wend
Set doc = New NotesDocument( session.CurrentDatabase )
Set rtitem = New NotesRichTextItem( doc, "Body" )
Set object = rtitem.EmbedObject _
( EMBED_OBJECT, "Microsoft Excel Worksheet", "", _
"Report" )
Set handle = object.Activate( True )
handle.Application.Cells( 1,2).Value = Columnname3
handle.Application.Cells( 1,3).Value = Columnname4
handle.Application.Cells( 1,4).Value = Columnname5
handle.Application.Cells( 1,5).Value = Columnname6
handle.Application.Cells( 1,6).Value = Columnname7
handle.Application.Cells( 2,1).Value = "Yes"
handle.Application.Cells( 2,2).Value = yescounter3
handle.Application.Cells( 2,3).Value = yescounter4
handle.Application.Cells( 2,4).Value = yescounter5
handle.Application.Cells( 2,5).Value = yescounter6
handle.Application.Cells( 2,6).Value = yescounter7
handle.Application.Cells( 3,1).Value = "No"
handle.Application.Cells( 3,2).Value = counter3
handle.Application.Cells( 3,3).Value = counter4
handle.Application.Cells( 3,4).Value = counter5
handle.Application.Cells( 3,5).Value = counter6
handle.Application.Cells( 3,6).Value = counter7
handle.Application.Worksheets.Copy
' handle.Parent.Save
' If ( handle Is Nothing ) Then
' doc.Subject = "This object has no OLE automation interface"
' Else
' doc.Subject = "This object has an OLE automation interface"
' End If
' Call doc.Save( True, True )
Print "Done"
Print " "
End Sub
发表于 2005/3/17 11:23:24 | 显示全部楼层
请问你这种方法,导出后是在服务器上还是在客户机上都可以显示出来
发表于 2005/4/8 10:46:10 | 显示全部楼层
你难道不会用循环吗?
发表于 2005/6/3 11:38:52 | 显示全部楼层
朋友,怎我怎么也弄不出来,找不到原因,
还有就是用按钮加入楼主的程序,可运行
起来,在浏览器上看不到按钮是怎么回事
呀!请帮主们指点一二,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

GMT+8, 2025/11/30 03:40 , Processed in 0.014408 second(s), 16 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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