[Solved] Report builder automatic saving & opening as Report

Discuss the database features

[Solved] Report builder automatic saving & opening as Report

Postby juergen_1987 » Thu Jul 30, 2015 12:06 pm

Hy,

i use the reportbuilder to create some reports. Is it possible to automatic store the report as Pdf (with a macro) and open the pdf file?


I have a macro to open a file:
http://en.libreofficeforum.org/node/6842


Code: Select all   Expand viewCollapse view
' sFile = "path\filename"
sub OpenDocument(sFile)
  oSer = createUNOService("com.sun.star.system.SystemShellExecute")
  oSer.execute(sFile,,0)
end sub


so i need a code to store a report as pdf in a path. can you help me or do you know any similar code?
Last edited by juergen_1987 on Mon Aug 10, 2015 10:29 am, edited 3 times in total.
OpenOffice 4.1.1 and Libreo. 4.4.x on Windows 7
juergen_1987
 
Posts: 16
Joined: Mon Jan 16, 2012 9:00 pm

Re: Report builder automatic saving and opening as Report

Postby Villeroy » Thu Jul 30, 2015 12:07 pm

Yes, it is possible.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27296
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Report builder automatic saving and opening as Report

Postby juergen_1987 » Thu Aug 06, 2015 10:50 pm

I found a nice discripton to create a PDF in a german forum.
http://de.openoffice.info/viewtopic.php?f=1&t=55753&start=15 the last post of ejomi (second last entry)
The link to the Tutorial "API/Tutorials/PDF export"
https://wiki.openoffice.org/wiki/API/Tutorials/PDF_export

i will have to decide where i want to use this function.
OpenOffice 4.1.1 and Libreo. 4.4.x on Windows 7
juergen_1987
 
Posts: 16
Joined: Mon Jan 16, 2012 9:00 pm

Re: Report builder automatic saving and opening as Report

Postby juergen_1987 » Mon Aug 10, 2015 10:28 am

Now i solved this problem.
Here is an example how you can open a report and generate a PDF. The function ExportPDF is from german forum (link from to function is in the post above).
I have changed a little thing. Now I don't open the report as pdf.


Code: Select all   Expand viewCollapse view
' FROM: http://www.oooforum.org/forum/viewtopic.phtml?t=65111
sub OpenBerichtsabfrage2()
   OpenReport("berichtabfrage-de" )
       ExportPDF
end sub


sub OpenReport(sReportName as string)   
   Dim aProp(1) As New com.sun.star.beans.PropertyValue
   aProp(0).Name = "ActiveConnection"
   aProp(0).Value = connection 'GetConnection
   aProp(1).Name = "OpenMode"
   aProp(1).Value = "open"   'http://www.openoffice.org/api/docs/common/ref/com/sun/star/sdb/DocumentDefinition.html
   thisComponent.Parent.getReportDocuments.loadComponentFromURL(sReportName,"_blank",6,aProp())   '_blank,6
end sub
OpenOffice 4.1.1 and Libreo. 4.4.x on Windows 7
juergen_1987
 
Posts: 16
Joined: Mon Jan 16, 2012 9:00 pm


Return to Base

Who is online

Users browsing this forum: No registered users and 4 guests