Page 1 of 1

[Solved] Report builder automatic saving & opening as Report

PostPosted: Thu Jul 30, 2015 12:06 pm
by juergen_1987
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?

Re: Report builder automatic saving and opening as Report

PostPosted: Thu Jul 30, 2015 12:07 pm
by Villeroy
Yes, it is possible.

Re: Report builder automatic saving and opening as Report

PostPosted: Thu Aug 06, 2015 10:50 pm
by juergen_1987
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.

Re: Report builder automatic saving and opening as Report

PostPosted: Mon Aug 10, 2015 10:28 am
by juergen_1987
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