OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Call a report from a form

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
keithclark1966
OOo Enthusiast
OOo Enthusiast


Joined: 18 Jan 2007
Posts: 189

PostPosted: Fri Dec 05, 2008 9:20 am    Post subject: Call a report from a form Reply with quote

Is there a way to print a report from within a form?

Keith
_________________
Open Office 3.0 under Ubuntu 9.04, XP and Vista
Back to top
View user's profile Send private message
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Fri Dec 05, 2008 2:52 pm    Post subject: Reply with quote

Hello
This sub can open a report and print the report to the default printer. I don't know if it is possible to do ask for which printer.

this links tell something about uno:print.
http://www.oooforum.org/forum/viewtopic.phtml?t=6049
http://www.oooforum.org/forum/viewtopic.phtml?t=76847&highlight=uno+print
http://www.oooforum.org/forum/viewtopic.phtml?t=70190&highlight=uno+print
I knew it is working with OOo 3.0 but I cannot test it for lower version. And I think that the loadComponent methode is not working with OOo2.3 and lower

Romke


Code:
sub openform_report
' First try to make compatible OO3.0 with ThisdatabaseDocument and Thiscomponent
dim oThisDatabaseDocument ' I do use this
' first I think this is a solution for Open Office lower then OOo3.0
if  GetSolarVersion=300 then
   ' I do get this number with OOo3.0
   oThisDatabaseDocument=ThisDatabaseDocument
   else
   oThisDatabaseDocument=thiscomponent.parent
end if

'for information look here
'http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/application/XDatabaseDocumentUI.html
' I think that this line can test if object has the good sevice.
if not HasUnoInterfaces(oThisDatabaseDocument.CurrentController,"com.sun.star.sdb.application.XDatabaseDocumentUI") then
   print "Your version of Open Office does not have this capabillities"
end if

dim oCurrentController
oCurrentController=oThisDatabaseDocument.CurrentController

dim sNewfileReportName ' This is the name how it is in the database
dim oNewReportSee ' Object for the new form wat will beopend
sNewfileReportName="testquery" 'is a write form I think it must be in this database


'http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/application/XDatabaseDocumentUI.html
'http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/application/DatabaseObject.html
'http://api.openoffice.org/docs/common/ref/com/sun/star/sdb/XSQLErrorBroadcaster.html#addSQLErrorListener
'com.sun.star.sdb.application.DatabaseObject.FORM ' use this for form
'com.sun.star.sdb.application.DatabaseObject.REPORT ' use this for report

' there are two form of the command
oNewReportSee=oCurrentController.loadComponent( com.sun.star.sdb.application.DatabaseObject.REPORT,sNewfileReportName,FALSE) ' or TRUE for editing the document

' The next code acts on the report
dim document,dispatcher
'document = ThisComponent.CurrentController.Frame
document = oNewReportSee.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args4(1) as new com.sun.star.beans.PropertyValue
' This print to the default printer whithout any question
args4(0).Name = "Copies"
args4(0).Value = 1
args4(1).Name = "Collate"
args4(1).Value = true
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args4())
end sub



I think that this values are all possible in the array
MakePropertyValue( "Copies", 1 )
MakePropertyValue( "Selection", True )
MakePropertyValue( "Collate", False )
Back to top
View user's profile Send private message
MSPhobe
Super User
Super User


Joined: 29 Sep 2005
Posts: 529
Location: England

PostPosted: Sat Dec 06, 2008 5:48 am    Post subject: Reply with quote

Forgive me talking about something I don't know about... but this sounds like it might be the sort of thing "Switchboard" is for.

I hope Switchboard experts will comment...
Back to top
View user's profile Send private message
keithclark1966
OOo Enthusiast
OOo Enthusiast


Joined: 18 Jan 2007
Posts: 189

PostPosted: Sat Dec 06, 2008 8:33 am    Post subject: Reply with quote

Switchboard?
_________________
Open Office 3.0 under Ubuntu 9.04, XP and Vista
Back to top
View user's profile Send private message
MSPhobe
Super User
Super User


Joined: 29 Sep 2005
Posts: 529
Location: England

PostPosted: Sat Dec 06, 2008 2:34 pm    Post subject: Reply with quote

See Tools | Extension Manager, and filter by application.

"Generates a... (menu) interface to access Base forms and reports."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group