Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

now, i changed something in my macro and it runs succesfully. If there is more optimal solution, please recommend it

sub ExportToPDF (Optional outputFile as String)

dim document as object
dim dispatcher as object
dim NumStyle as integer
dim target as string

target = ConvertToURL(outputFile)

oStyleFamilies = ThisComponent.StyleFamilies
oPageStyles = oStyleFamilies.getByName("PageStyles")
numStyle = oPageStyles.Count 

For iCount = 0 To numStyle-1
oDefaultStyle = oPageStyles(iCount)
oDefaultStyle.ScaleToPagesX = 1
oDefaultStyle.ScaleToPagesY = 1
Next iCount

document   = component.CurrentController.Frame
dispatcher = createUnoService("")

dim args1(1) as new
args1(0).Name = "URL"
args1(0).Value = target
args1(1).Name = "FilterName"
args1(1).Value = "calc_pdf_Export"
dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1())

end sub