Lotus script UNO API: Export Sheet To PDF

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
maarc_cnj
Posts: 1
Joined: Fri Jan 24, 2020 9:50 am

Lotus script UNO API: Export Sheet To PDF

Post by maarc_cnj »

Hi, I'm trying to convert the following macro to lotusScript and I can't find a way to apply the "FilterData" property.

Someone could tell me how the right code should be.

The macro is:

Code: Select all

Sub ExportActiveSheetPrintRangeToPDF

'Get Active Sheet
   dim document   as object
   dim dispatcher as object
   dim oSheet as object

   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
   oSheet = thiscomponent.getcurrentcontroller.activesheet
   
'Get Print Range - if no print range has been defined for the Active Sheet, then it will export the entire Active Sheet
   dim aFilterData(0) as new com.sun.star.beans.PropertyValue
   aFilterData(0).Name = "Selection"
   aFilterData(0).Value = oSheet

'Export to PDF
   dim args1(1) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "FilterName"
   args1(0).Value = "calc_pdf_Export"
   args1(1).Name = "FilterData"
   args1(1).Value = aFilterData()

   dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())

'File Done (added this next line so that user knows when file is complete)
   Beep

End Sub
Thank you.
OpenOffice 3.1 on Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Lotus script UNO API: Export Sheet To PDF

Post by Villeroy »

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
Post Reply