[Linux-Biella] Modifica macro in OO Calc
marco dm
marco2265 a gmail.com
Sab 6 Nov 2010 18:17:50 CET
Non sono solito disturbarvi per le mie stupidate ma leggo i vostri messaggi
con una certa continuità, veniamo al mio problemino.
Ho registrato una semplice macro il cui compito sarebbe quello di Esportarmi
in PDF, o una selezione o una pagina precisa, un file di Calc.
Il primo problema è che benchè io durante la registrazione faccia o la
selezione o gli indichi quale pagina esportare, la macro esporta sempre
tutto il file.
Naturalmente durante la registrazione, l'esportazione in PDF è corretta.
L'esecuzione della macro, no
Questo è relativo alla esportazione della selezione che comunque non
funziona:
sub Esporta_selezione_PDF
> rem ----------------------------------------------------------------------
> rem define variables
> dim document as object
> dim dispatcher as object
> rem ----------------------------------------------------------------------
> rem get access to the document
> document = ThisComponent.CurrentController.Frame
> dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
> rem ----------------------------------------------------------------------
> dim args1(0) as new com.sun.star.beans.PropertyValue
> args1(0).Name = "ToPoint"
> args1(0).Value = "$A$1:$AR$53"
> dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
> rem ----------------------------------------------------------------------
> dim args2(3) as new com.sun.star.beans.PropertyValue
> args2(0).Name = "URL"
> args2(0).Value = "file:///home/marco/Modelli/Ricevuta%20NUMERO%20NOME.pdf"
> args2(1).Name = "FilterName"
> args2(1).Value = "calc_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("FormsType",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportFormFields",0,true,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("Selection",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))
> args2(3).Name = "SelectionOnly"
> args2(3).Value = false
> dispatcher.executeDispatch(document, ".uno:ExportToPDF", "", 0, args2())
>
> end sub
>
>
>>
A dire il vero, questo è il problema minore, perchè al limite potrei provare
a crearmi un file CALC apposta con solo la pagina incriminata così
bypasserei il problema.
La personalizzazione più difficile per me è il nome del salvataggio del
file:
args2(0).Value = "file:///home/marco/Modelli/Ricevuta%20NUMERO%20NOME.pdf"
Io vorrei sostituire a NUMERO, un numero presente in una cella (esempio
=A1). Idem per NOME
Grazie a tutti per l'eventuale aiuto; tenete presente che io sono a digiuno
completo di qualsiasi linguaggio
--
marco2265 a gmail.com
marco dm
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://ml.bilug.linux.it/pipermail/linux/attachments/20101106/306afa28/attachment.htm>
Maggiori informazioni sulla lista
Linux