Export to Excel on NO Microsoft Server

Hello to all,please give me some ideas!!!

I’ve an application that is not on Microsoft server. I must export some data from my db to excel. But as I know, to export to excel I use OLE Object from Excel and on my server cannot run. Can I’ use the excel on client machine? And how ?

Please help me!!

thank U :slight_smile:

Subject: here is my code to do this…

Place the following in the appropraite events of an action…

Options

Option Public

Option Declare

Declarations

Dim xlApp As Variant

Dim xlWb As Variant

Dim xlWs As Variant

Initialize

Sub Initialize

’ Create a document collection from selected docs

’ Move doc collection to a folder

’ Process items in the folder as a view entry

’ Remove from folder

Dim session As New NotesSession

Dim db As NotesDatabase	

Dim dc As NotesDocumentCollection

Dim view As NotesView

Dim vc As NotesViewEntryCollection

Dim entry As NotesViewEntry

Dim doc As NotesDocument

Dim x As Integer

Dim cp As Integer ' used to count the offset position of the columns

x=1 ' used to count the number of the selected document

cp=0



Set db = session.CurrentDatabase

If (db Is Nothing) Then Goto endofsub	

Set dc = db.UnprocessedDocuments     ' gets a handle on the documents you selected

’ since selected documents are not processed in the order that they are displayed in the view

’ i move the selected documents to their own “sorted” folder, and then process all of them from there

Call dc.PutAllInFolder( "temp" )                    ' moves those selected documents into a folder

Set view = db.GetView("temp")

Set vc = view.AllEntries                                  ' gets a handle on all the documents in the folder

’ Get a handle on the required Excel Objects

Set xlApp = CreateObject("excel.application")

Set xlWb = xlApp.WorkBooks.Add()

Set xlWs = xlWb.WorkSheets.Add()		

xlApp.Visible = True	



If vc.Count = 0 Then

	Messagebox "You must select at least one document"

	Goto EndOfSub

End If

’ Add view column titles

Forall columns In view.Columns

	xlWs.Range("A1").OffSet(0,cp).Font.Bold=True  ' make bold

	xlWs.Range("A1").OffSet(0,cp).HorizontalAlignment = 3  'center in cell

	xlWs.Range("A1").OffSet(0,cp).value=columns.Title

	cp=cp+1

End Forall	

’ Add data from selected documents to Excel

For x = 1 To vc.Count

	Set entry = vc.GetNthEntry(x)

	cp=0 ' reset the column position			

	xlWs.Range("A1").OffSet(x,0).Font.Bold = True ' make the row titles (column 1) bold		

	Forall columns In entry.ColumnValues

		If Not cp = 0 Then ' format all the columns but the first one	

			xlWs.Range("A1").OffSet(x,cp).NumberFormat = "0.00"			

		End If

		xlWs.Range("A1").OffSet(x,cp).value=columns

		cp= cp + 1

	End Forall

Next

xlWs.	Columns("A:A").EntireColumn.AutoFit



Call dc.RemoveAllFromFolder( "temp" )	

Print "Done processing " & vc.count & " documents."

endofsub:

’ place any wrap up stuff here

End Sub

Terminate

xlApp.DisplayAlerts = False

xlApp.Quit ’ use the Quit method to close

Set xlApp = Nothing ’ release the reference.

Subject: Export to Excel on NO Microsoft Server

Can I’ use the excel on client machine?

Sure… all you have to do is run the agent on the client machine to take data from the DB and create the MS Excel file.

An alternative would be to export the data as comma-delimited (server-side) and then that file could be opened in Excel by Win clients, or a text editor by your server and/or Unix clients.