Работа с Openoffice Calc

azat20

Well-known member
22.07.2008
244
0
#1
Добрый день!В Лотусе работаю пока мало. Подскажитке,пожалуйста, как сделать сортировку по полям в OpenOffice Calc. Методы найденные в инете, в частности такого вида
Dim aSortFields(8) As New com.sun.star.util.SortField
Dim aSortDesc(0) As New com.sun.star.beans.PropertyValue
не работают. С object тоже. Как решить задачу без их использования?!

Код:
Sub ExportToCalc ( thisView As NotesView )
Dim thisDoc As NotesDocument
Dim i As Double
Dim mass()
Dim xlWbk As Variant

Set xlglob = CreateObject ( "com.sun.star.ServiceManager" )
Set Desktop = xlglob.createInstance("com.sun.star.frame.Desktop")
Set document = Desktop.LoadComponentFromURL("private:factory/scalc","_ blank",0,mass)
Set sheets=Document.getSheets()
Set xlWbk = sheets.getByIndex(0)
Set xlglob= Nothing

Set thisDoc = thisView.GetFirstDocument
If thisDoc Is Nothing Goto exit_sub
xlWbk.getCellRangeByName("A1:C1").CharWeight=150
xlWbk.getCellByPosition(0,0).string="Name"
xlWbk.getCellByPosition(1,0 ).string="Family"
xlWbk.getCellByPosition(2,0 ).string="Widht"
i = 2'start from 3 row
While Not thisDoc Is Nothing

FirstName$ = thisDoc.FirstName(0)
LastName$ = thisDoc.LastName(0)
Weight = thisDoc.weight(0)

'___ put values to the row
xlWbk.getCellByPosition(0,i ).string=FirstName$
xlWbk.getCellByPosition(1,i ).string=LastName$
xlWbk.getCellByPosition(2,i ).value=Weight
i = i + 1

Set thisDoc = thisView.GetNextDocument ( thisDoc )
xlWbk.Columns().OptimalWidth=True 'autoshirina

Wend
exit_sub:
Set xlWbk = Nothing
Call document.storeToURL("file:///c:/otchetInCalc.ods", mass())
Set xlglob = Nothing
Set document = Nothing
Set sheets = Nothing
Set desktop = Nothing

End Sub
Всех благодарю за ответы!