incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernand Vanrie <...@pmgroup.be>
Subject Re: VBA
Date Wed, 04 Jul 2012 07:47:45 GMT
Stefan ,

i use this code to open and run a report, the filter handling  is included

Sub Main ( sReportName ,sFilter, sBlancoFilter as string)

on local error goto errh
     context = createUnoService("com.sun.star.sdb.DatabaseContext")
     oDataBase = context.getByName("mysql_native_PMG_reports")
     oDBDoc = oDataBase.DatabaseDocument
     aArguments() = oDBDoc.getArgs()
   For i=LBound(aArguments()) To UBound(aArguments() ) ' nodig om te 
beletten dat er gevraagd wordt de macro's uit te voeren
     If ( aArguments(i).Name = "MacroExecutionMode" ) Then
       aArguments(i).Value = 
"com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE"
     End If
   Next i
   oDBDoc.attachResource( oDBDoc.URL, aArguments() )

    oReports = oDBDoc.getReportDocuments()
    dim Arguments(2) as New com.sun.star.beans.PropertyValue
     Arguments(0).Name = "OpenMode"
     Arguments(0).Value = "open" 'openDesign
     Arguments(1).Name = "ActiveConnection"
     Arguments(1).Value = oDatabase.getConnection("sos","hooghte")
     Arguments(2).Name = "Hidden"
     Arguments(2).Value = true
    toclose = oReports.loadComponentFromURL(sReportName 
,"_blank",0,Arguments()) ' open en sluiten om bepaalde componenten in 
geheugen te laden
    wait 1000
    toclose.close(true)
    oReport = oreports.getbyname(sReportName)

    oreportComponent = oreport.component

    oreportComponent.Filter = sFilter   ' xray oreportCom
    oReport.open
    ' filter weer op "niets te vinden zetten" anders blijft hij de 
settings van vorige run onthouden
    oreportComponent.filter = sBlancoFilter
    ' xray oreportCom
    ' print "stop"
exit sub
ErrH:
     beep
     MsgBox "Error " & err & ": " & error$ , 16

  end sub

hope it helps

Fernand
> I want open a Report and change the filter dynamicly
>
> I found the Code to Open
> subdlg = 
> getController().loadComponent(com.sun.star.sdb.application.DatabaseObject.REPORT,"Ergebnisse",FALSE)
>
> but i dont know how i change the filter in the report
>
> mfg
>
> Stefan



Mime
View raw message