Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Change scaling mode with libreoffice macro

Hello, i wrote a macro and it runs in Windowds successfully. However, there is no action about changing scaling mode in Linux (Centos 7). i guess there is a problem about argumans of page setup. The macro code is like below;

My expectation from macro: scaling the each sheet of excel/calc as one page (width and height) and export as PDF

Sub SaveSheetAsPDF(optional inputArg as string, optional outputArg as string)

dim document as object dim dispatcher as object dim component as object rem ---------------------------------------------------------------------- rem get access to the document

dim inputFile as string dim outputPath as string

inputFile = "file:///"+inputArg outputFile = "file:///"+outputArg

dim args2(1) as new com.sun.star.beans.PropertyValue args2(0).Name = "MacroExecutionMode" args2(0).Value = 4 args2(1).Name = "Hidden" args2(1).Value = False

component = StarDesktop.loadComponentFromURL(inputFile, "_default",0,args2) document = component.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args(4) as new com.sun.star.beans.PropertyValue args(0).Name = "fitToHeight" args(0).Value = 1 args(1).Name = "fitToWidth" args(1).Value = 1 args(2).Name = "firstPageNumber" args(2).Value = 0 args(3).Name = "scale" args(3).Value = 100 args(4).Name = "orientation" args(4).Value = "portrait"

dispatcher.executeDispatch(document, ".uno:PageSetup", "", 0, args())

dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = "URL" args1(0).Value = outputFile args1(1).Name = "FilterName" args1(1).Value = "calc_pdf_Export" dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())

End Sub

Change scaling mode with libreoffice macro

Hello, i wrote a macro and it runs in Windowds successfully. However, there is no action about changing scaling mode in Linux (Centos 7). i guess there is a problem about argumans of page setup. The macro code is like below;

My expectation from macro: scaling the each sheet of excel/calc as one page (width and height) and export as PDF

Sub SaveSheetAsPDF(optional inputArg as string, optional outputArg as string)

string) dim document as object dim dispatcher as object dim component as object rem ---------------------------------------------------------------------- rem get access to the document

document dim inputFile as string dim outputPath as string

string inputFile = "file:///"+inputArg outputFile = "file:///"+outputArg

"file:///"+outputArg dim args2(1) as new com.sun.star.beans.PropertyValue args2(0).Name = "MacroExecutionMode" args2(0).Value = 4 args2(1).Name = "Hidden" args2(1).Value = False

False component = StarDesktop.loadComponentFromURL(inputFile, "_default",0,args2) document = component.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

createUnoService("com.sun.star.frame.DispatchHelper") dim args(4) as new com.sun.star.beans.PropertyValue args(0).Name = "fitToHeight" args(0).Value = 1 args(1).Name = "fitToWidth" args(1).Value = 1 args(2).Name = "firstPageNumber" args(2).Value = 0 args(3).Name = "scale" args(3).Value = 100 args(4).Name = "orientation" args(4).Value = "portrait"

"portrait" dispatcher.executeDispatch(document, ".uno:PageSetup", "", 0, args())

args()) dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = "URL" args1(0).Value = outputFile args1(1).Name = "FilterName" args1(1).Value = "calc_pdf_Export" dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())

args1()) End Sub

Sub