Hi, I need to do what is in subject, calling the macro through php exec() function; in fact I need to do it, in a website, so trasparently for the user; now I'm developing in a Windows Seven environment, then I will have to migrate to Linux.
Using Macros (Basic) I can already export to pdf without any dialog box shown to the user (even if I still have some problem with exec(), I can execute the code in a simple prompt Windows... I guest the problem with php is related to users and privileges... anyway).
The problem is the line numbers. I've tried to record a Macro to have a basic macro to start working on, and I've found this instruction:
dispatcher.executeDispatch(document, ".uno:LineNumberingDialog", "", 0, array())
The problem is that this instruction open a dialog, and I don't want it. I want all the process works trasparently, without asking anything.
I searched a lot, for info on LineNumberingDialog but I didn't found anything really helpful.
Do you have ideas if and how can I get what I want?
[Solved] Add line numbers and export to pdf via macro
[Solved] Add line numbers and export to pdf via macro
Last edited by cemsal on Wed Feb 02, 2011 10:53 am, edited 1 time in total.
OpenOffice 3.3 on Windows Seven
Re: Add line numbers and export to pdf via macro
In the Basic,
Code: Select all
ThisComponent.getLineNumberingProperties().IsOn = True
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
Apache OpenOffice 4-dev on Xubuntu 14.04
Re: Add line numbers and export to pdf via macro
Wow, really thank you. Last thing I need, is to modify some options (for example the interval between numbers, the position, etc.). How can I do that? Does exist online a list of the options that I can use via macro for the line numbers?
OpenOffice 3.3 on Windows Seven
Re: Add line numbers and export to pdf via macro
Here you are:
http://api.openoffice.org/docs/common/r ... rties.html
http://api.openoffice.org/docs/common/r ... rties.html
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
Apache OpenOffice 4-dev on Xubuntu 14.04
Re: [Solved] Add line numbers and export to pdf via macro
Can you share that macro...pls.....
OpenOffice 3.1
Re: [Solved] Add line numbers and export to pdf via macro
Hey, I here is the code (it's a Basic Macro)
Bye
I hope it will be helpful for you.REM ***** BASIC *****
sub Main (fileinput, fileoutput)
dim InputUrl as String
InputUrl = convertToUrl(fileinput)
rem MsgBox(InputUrl)
dim OutputUrl as String
OutputUrl = convertToUrl(fileoutput)
rem MsgBox(OutputUrl)
dim document as object
dim dispatcher as object
dim pPropValues(1) as new com.sun.star.beans.PropertyValue
pPropValues(0).Name = "ReadOnly"
pPropValues(0).Value = true
pPropValues(1).Name = "Hidden"
pPropValues(1).Value = true
document = starDeskTop.loadComponentFromUrl(InputUrl, "_blank", 0, pPropValues())
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
document.getLineNumberingProperties().IsOn = True
document.getLineNumberingProperties().Interval = 1
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "URL"
args2(0).Value = OutputUrl
args2(1).Name = "FilterName"
args2(1).Value = "writer_pdf_Export"
args2(2).Name = "FilterData"
args2(2).Value = Array(Array("UseLosslessCompression",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Quality",0,90,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("MaxImageResolution",0,300,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTaggedPDF",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("SelectPdfVersion",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarks",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenBookmarkLevels",0,-1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTransitionEffects",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsSkipEmptyPages",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsAddStream",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EmbedStandardFonts",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FormsType",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportFormFields",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("AllowDuplicateFieldNames",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerToolbar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerMenubar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerWindowControls",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ResizeWindowToInitialPage",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("CenterWindow",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenInFullScreenMode",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DisplayPDFDocumentTitle",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialView",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Magnification",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Zoom",0,100,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PageLayout",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FirstPageOnLeft",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialPage",0,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Printing",0,2,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Changes",0,4,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableCopyingOfContent",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableTextAccessForAccessibilityTools",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportLinksRelativeFsys",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PDFViewSelection",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ConvertOOoTargetToPDFTarget",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarksToPDFDestination",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("_OkButtonString",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EncryptFile",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DocumentOpenPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("RestrictPermissions",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PermissionPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))
dispatcher.executeDispatch(document.getCurrentController(), ".uno:ExportToPDF", "", 0, args2())
document.setModified(false)
document.close(true)
end sub
Bye
OpenOffice 3.3 on Windows Seven