OpenNTF.org - Export data to OpenOffic
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
Export data to OpenOffic 
Rating:
Not Rated Yet 
Contributor:
Sudip Singha Roy 
Category:
Lotusscript 
Type:
Example Code 
Notes Version:
R8.x 
Last Modified:
01 Mar 2009 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
This code exports excel data to OpenOffice.org Calc (similar to exporting Notes Data to MS Excel).

Paste the code below in a view button and make necessary changes to the fields and columns numbers as required.

Hope you'll enjoy using it


Sub Click(Source As Button)

''==''==''==''=='' Code For Creating Office Application Automation Object ''==''==''==''==''
Dim SM As Variant
Dim Desktop As Variant
Dim args() As Variant
Dim calApplication As Variant
Dim worksheet As Variant
Dim cell As Variant

'' Creating Handle To OpenOffice Object
Set SM = CreateObject("com.sun.star.ServiceManager")

'' Create The Front-End Reference
Set Desktop = SM.createInstance("com.sun.star.frame.Desktop")

'' Opening The Excel Application On Desktop Giving Focus
Set calApplication = Desktop.loadComponentFromURL("private:factory/scalc", "_blank" , 0 , args)

'' Setting Sheet Name
Set worksheet = calApplication.Sheets.getByName("Sheet1")

''Set cell = worksheet.getCellByPosition(0,0)
''cell.setString("Testing Transport To OpenOffice")
''==''==''==''=='' Code For Creating Office Application Automation A Object ''==''==''==''==''

Dim uiws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim view As NotesView
Dim doc As NotesDocument

Dim counter As Integer
Dim xlr,xlc,loops As Integer
Dim cell1,cell2,cell3 As Variant

Set uiview = uiws.CurrentView
Set view = uiview.View

loops = view.AllEntries.Count

Set doc = view.GetFirstDocument

Dim i As Integer
i=0
For i=0 To loops-1
'' '' Exporting Notes-Data Code To OpenOffice Calc Applicaiton
Set cell1 = worksheet.getCellByPosition(0,i)
Set cell2 = worksheet.getCellByPosition(1,i)
Set cell3 = worksheet.getCellByPosition(2,i)

cell1.setString(Cstr(doc.EDForwardID(0)))
cell2.setString(Cstr(doc.EDEmpMailID(0)))
cell3.setString(Cstr(doc.EDEmpPh(0)))

If(i<loops-1) Then
Set doc = view.GetNextDocument(doc)
End If

Next

worksheet.Columns.Autofit


End Sub

Usage / Example
 Comments

No documents found

 Add your comment!