注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

mylotustips的博客

IBM Lotus协作产品家族经验分享

 
 
 

日志

 
 
关于我

欢迎大家使用SR向IBM800提交问题http://www.ibm.com/support/servicerequest 可以随时查看问题状态,上传文件

网易考拉推荐

LotusScript样例:将指定视图中所有文档另存为文本  

2012-12-18 22:20:30|  分类: LotusScript |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 %REM

    Agent ExportText

    Created 2012-12-9 by MyLotusTips

    Description: Agent for Export All Fields to Text in Specific View

    使用方法,创建代理,运行时 - 触发器“基于事件”:“操作菜单选择”
    目标“无”
    运行代理即可

%END REM

Option Public

Option Declare


Sub Initialize

    Dim s As New NotesSession

    Dim ws As New NotesUIWorkspace

    Dim db As NotesDatabase

    Dim v As NotesView

    Dim viewNames() As String

    Dim i As Integer

    Dim viewToExport As String

    Dim filename As String

    Dim doc As NotesDocument

    Dim fileNum As Integer

    Set db = s.CurrentDatabase

    ReDim viewNames(0)

    i = 0

    ForAll indView In db.Views

      ReDim Preserve viewNames(i)

      viewNames(i) = indView.Name

      i = i+1

    End ForAll

    viewToExport = ws.Prompt(4, "Choose View", "Choose the view to export from the list below:", "", viewNames)

    If viewToExport = "" Then

        MessageBox ("No view has been selected")

    Exit Sub

    End If

    FileName = InputBox$("Enter the exported file name: ", "LotusScript Export", "C:\")

    If (FileName = "") Then

        MessageBox ("Export has been canceled")

        Exit Sub

    End If

 

    Set v = db.GetView(viewToExport)    'Change this to any view you wish, one that includes all documents you wish to export

    Set doc = v.GetFirstDocument

    fileNum = FreeFile()

    Open FileName For Output As fileNum 'Change FileName to the path and filename you wish to create

    'This block loops through every field for every document and sends it to the output file

    Do Until doc Is Nothing

        ForAll j In doc.Items

            Print #fileNum, j.name & ": " & j.text

        End ForAll

    'Adding modified timestamp and breaking line as separator between each document

        Print #fileNum, CStr(doc.initiallymodified)

        Print #fileNum, Chr(12)

        Set doc = v.GetNextDocument(doc)

        On Error Resume Next

    Loop

    Close #fileNum

End Sub

  评论这张
 
阅读(553)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017