資料匯出 Lotus Notes

2021-08-22 12:50:17 字數 4542 閱讀 4267

匯出到excel中

sub click(source as button)

dim s as new notessession

dim db as notesdatabase

dim view as notesview

dim dc as notesdocumentcollection

dim doc as notesdocument

dim vcols as variant

dim uvcols as integer

set db = s.currentdatabase

set dc = db.unprocesseddocuments

set view = db.getview("當前檢視的名稱 ")

uvcols=ubound(view.columns)

dim xlsheet as variant

'建立乙個excel物件

'新增工作薄

'為工作表命名

xlsheet.name = "notes export"

dim rows as integer

rows = 1

dim cols as integer

cols = 1

dim maxcols as integer

for x=0 to ubound(view.columns)

if view.columns(x).ishidden = false then

if view.columns(x).title<>"" then

xlsheet.cells(rows,cols).value = view.columns(x).title

cols = cols + 1

end if

end if

next

maxcols=cols-1

set doc=dc.getfirstdocument

dim fieldname as string

dim fitem as notesitem

rows=2

cols=1

do while not(doc is nothing)

for x=0 to ubound(view.columns)

if view.columns(x).ishidden=false then

if view.columns(x).title<>"" then

fieldname = view.columns(x).itemname

set fitem = doc.getfirstitem(fieldname)

xlsheet.cells(rows, cols).value = fitem.text

cols = cols +1

end if

end if

next

rows = rows+1

cols = 1

set doc= dc.getnextdocument(doc)

loop

%rem

%end rem

.pagesetup.orientation = 2

.pagesetup.centerheader = "report _ confidential"

.pagesetup.rightfooter = "page &p" & chr$(13) & "date:&d"

.pagesetup.centerfooter = ""

end with

end sub

b) 以**形式匯出

sub initialize

%rem

功能:匯出內部資料到excel中去

%end rem

on error goto unknowerr

dim session as new notessession

dim db as notesdatabase

dim view as notesview

dim tempdoc as notesdocument

dim strtemp as string

dim strpath as string

if session.currentdatabase.filepath=session.currentdatabase.filename then

strpath=""

else

strpath=strleftback(session.currentdatabase.filepath,session.currentdatabase.filename)

end if

set db=new notesdatabase("",strpath & "db_staffinformation.nsf")

set view=db.getview("hvpersoninfo")

print

print {}

print {}

print

print

print

print

print

print

print

print

print

print

print

print

print {}

'填寫資料

set tempdoc=view.getfirstdocument

while not tempdoc is nothing

print {}

'工號print {} & cstr(tempdoc.employeeid(0)) & {}

'姓名dim neibuname as notesname

set neibuname=new notesname(tempdoc.myname(0))

print {} & neibuname.common & {}

print {} & tempdoc.***(0) & {}

'工作單文

if neibuname.orgunit1<>"" then

strtemp=neibuname.orgunit1

end if

if neibuname.orgunit2<>"" then

strtemp=strtemp & "/" & neibuname.orgunit2

end if

if neibuname.orgunit3<>"" then

strtemp=strtemp & "/" & neibuname.orgunit3

end if

if neibuname.orgunit4<>"" then

strtemp=strtemp & "/" & neibuname.orgunit4

end if

print {} & strtemp & {}

'職務if tempdoc.jobtitle(0)="1" then

strtemp="員工"

end if

if tempdoc.jobtitle(0)="2" then

strtemp="業務主管"

end if

if tempdoc.jobtitle(0)="3" then

strtemp="副經理"

end if

if tempdoc.jobtitle(0)="4" then

strtemp="部門經理"

end if

if tempdoc.jobtitle(0)="5" then

strtemp="分管領導"

end if

if tempdoc.jobtitle(0)="6" then

strtemp="總經理"

end if

if tempdoc.jobtitle(0)="7" then

strtemp="董事長"

end if

print {} & strtemp & {}

print {} & tempdoc.location(0) & {}

print {} & tempdoc.officephonenumber(0) & {}

print {} & tempdoc.cellphonenumber(0) & {}

print {} & tempdoc.officefaxphonenumber(0) & {}

print {} & tempdoc.ip(0) & {}

print {} & tempdoc.officezip(0) & {}

print {} & tempdoc.internetaddress(0) & {}

print {} & tempdoc.officestreetaddress(0) & {}

print {}

set tempdoc=view.getnextdocument(tempdoc)

wend

print {}

exit sub

unknowerr:

messagebox "錯誤行:" & erl & "錯誤資訊:" & error

end sub

在山獅上安裝Lotus Notes

山獅 mac os 10.8 的腳步越來越近,這一版作業系統在做了眾多改進的同時,也或多或少影響了一些軟體的相容性,lotus notes也未能倖免。檢視系統 版本,我 們注意到 作業系統 名稱的描 述從 m ac os x 悄然變為了 os x 這一小小改動導致lotus note s的安裝 檔案...

Lotus Notes開發中的14個經驗

lotus notes開發中的14個經驗 1.當檢視太多時 將檢視分級顯示 不過注意 資料庫中在呼叫此檢視時應加上檢視的分級,例如 command openview viewclass view1 2.notes 的搜尋條功能極其強大 一般不用專為使用者開發資料庫搜尋功能 教會使用者使用 搜尋條即可...

資料匯出Excel表 資料庫資料匯出

public static hashmapcolumn new hashmap static param table 要匯出的表 param name 匯出的excel表名稱 表頭 throws exception public void createexcel string table,strin...