Sub TasksToCalc() Dim RowSetObj As Object, ConnectToDatabase As Object DBContext=createUnoService("com.sun.star.sdb.DatabaseContext") DataSource=DBContext.getByName("TasksDB") ConnectToDatabase=DataSource.GetConnection ("","") oURL="private:factory/scalc" oDoc=StarDesktop.loadComponentFromURL(oURL, "_blank", 0, Array()) oSheet=oDoc.Sheets(0) oSheet.Name="Tasks" SQLQuery= "SELECT ""Task"", ""Date"", ""Done"" FROM ""tasks"" ORDER BY ""Date"" ASC" SQLStatement=ConnectToDatabase.createStatement RowSetObj=SQLStatement.executeQuery (SQLQuery) While RowSetObj.Next i=i+1 oCell=oSheet.getCellByPosition(0,i) oCell.String=RowSetObj.getString(1) oCell=oSheet.getCellByPosition(1,i) oCell.String=RowSetObj.getString(2) oCell=oSheet.getCellByPosition(2,i) oCell.String=RowSetObj.getString(3) Wend Database.close Database.dispose() End Sub
Openoffice howto Software Programozás
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.