[Solved] Save Report in AOO Base with macro

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
branco
Posts: 3
Joined: Wed Feb 28, 2018 7:58 pm

[Solved] Save Report in AOO Base with macro

Post by branco »

Hi, I am new in AOO, but I am sure that my question can have response and thank you all in advance for your help.
Question: I have some tables, forms, query ecc.
In start up form with buttons, and querys in macro's produce some results, stored in a target table ( to be sure have this result later.. ).
I have also produced reports, based on this table.
Selecting report and clicking on it, is all ready ( as I want ) and I can save (OO or pdf format), print as normal operations in OO Writer from toolbars.
I want save report as pdf file automatically from click on one button ( and macro I suppose ) from startup form, not opening other forms, windows or apps.

What do you think ? is possible ?
Thank you

PS: I try, with some macros, and I can open report, but after this I do not know how procede in OO Writer to save it, and also I can save a document ( always with macro ) but this opoeration save the form where is button , not report !!
Last edited by branco on Thu Mar 01, 2018 1:20 am, edited 2 times in total.
Open Office 4.1.5 Windows 10 and Mac OS x 10.5
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Save Report in AOO Base with macro

Post by Villeroy »

Code: Select all

Dim props(0) as new com.sun.star.beans.PropertyValue
props(0).Name = "FilterName"
props(0).Value = "writer_pdf_Export"
oDoc.storeToURL("file://C:/path/name.pdf"),props())
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
branco
Posts: 3
Joined: Wed Feb 28, 2018 7:58 pm

Re: Save Report in AOO Base with macro

Post by branco »

Hi, thank you, but:
my report name is "Fattura" and I want save it with "Fattura_dd_mm_yy.pdf" name.
the sub called by pressing button is:
'==============================
sub exp_2()
Dim props(0) as new com.sun.star.beans.PropertyValue
sURL = convertToURL("Fattura_dd_mm_yy.pdf")
props(0).Name = "FilterName"
props(0).Value = "writer_pdf_Export"
oDoc.storeToURL(sURL,props())
end sub
'====================
but AOO give me "Object variable not set". Why ? I think ODoc is not defined, also for report name , where I define that I start from "Fattura" report and have as result "Fattura_dd_mm_yy.pdf" file ??

thank you
Open Office 4.1.5 Windows 10 and Mac OS x 10.5
branco
Posts: 3
Joined: Wed Feb 28, 2018 7:58 pm

Re: Solved! Save Report in AOO Base with macro

Post by branco »

after unsuccessful step I looking in Forum and found ( now sorry!) this post by Andy-Jordan :
http://ooo-forums.apache.org/en/forum/v ... 13&t=79145

Now is working om my Win10, Tomorrow try on Mac.
it is very close my need.

thank you. very much
or "Grazie"
Open Office 4.1.5 Windows 10 and Mac OS x 10.5
Post Reply