You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users-de@openoffice.apache.org by technik <te...@jrsch.de> on 2015/12/08 11:43:07 UTC

uno:ExportToPDF

Hallo,

ich habe ein Calc Dokument mit zwei Tabellen: Tab1 und Tab2

Mit einem Makro möchte ich einmal Tab1 in tab1.pdf exportieren. Dann 
entsprechend Tab2
Aber es wird nur immer das gesamte Dokument exportiert.

Wie kann ich nur Tab1 exportieren? (mit Makrobefehl)



Ich habe:
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "URL"
args2(0).Value = "file:///C:/Users/.../Liedliste1.pdf" (Pfad verändert)
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,100,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,true,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,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarks",0,false,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,false,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,false,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,0,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,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PDFViewSelection",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ConvertOOoTargetToPDFTarget",0,true,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("PreparedPasswords",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("RestrictPermissions",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PreparedPermissionPassword",0,Array(),com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))

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

Vielen Dank
|Horst|

Re: uno:ExportToPDF

Posted by technik <te...@jrsch.de>.
Hallo,
hat sich erledigt. Schließlich hat der Rekorder doch noch ein Ergebnis 
gebracht:
Man muss an den Array unten noch
,Array("PageRange",0,"4",com.sun.star.beans.PropertyState.DIRECT_VALUE
anhängen. Wobei 4 die Seit 4 ausgibt. Man kann auch 1-3 ausgeben.

Horst

Am 08.12.2015 um 11:43 schrieb technik:
> Hallo,
>
> ich habe ein Calc Dokument mit zwei Tabellen: Tab1 und Tab2
>
> Mit einem Makro möchte ich einmal Tab1 in tab1.pdf exportieren. Dann 
> entsprechend Tab2
> Aber es wird nur immer das gesamte Dokument exportiert.
>
> Wie kann ich nur Tab1 exportieren? (mit Makrobefehl)
>
>
>
> Ich habe:
> dim args2(2) as new com.sun.star.beans.PropertyValue
> args2(0).Name = "URL"
> args2(0).Value = "file:///C:/Users/.../Liedliste1.pdf" (Pfad verändert)
> 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,100,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,true,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,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarks",0,false,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,false,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,false,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,0,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,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PDFViewSelection",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ConvertOOoTargetToPDFTarget",0,true,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("PreparedPasswords",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("RestrictPermissions",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PreparedPermissionPassword",0,Array(),com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))
>
> dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, 
> args2())
>
> Vielen Dank
> |Horst|
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-de-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-de-help@openoffice.apache.org


Re: uno:ExportToPDF

Posted by Christian <ch...@soemtron.de>.
technik <te...@jrsch.de> schrieb:

> Sehr seltsam. Auf beiden läuft 4.1.1 unter Win7.

> Ich habe noch ein Doc = ThisComponent am anfang eingefügt.

Sorry, habe beim Ver-Übersichtlichen zu viel gelöscht. Schön zu sehen,  
daß es auch unter 4.x läuft, hier: 1.1.5 :-)
Updaten werde ich wohl erst, wenn Berechnungen mit Zellen, die Text  
enthalten (=Wert Null), wieder möglich sein werden (und nicht mehr #WERT!  
liefern) und/oder Drag&Drop deaktivierbar ist.

cu,
Christian

PGP Key available.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-de-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-de-help@openoffice.apache.org


Re: uno:ExportToPDF

Posted by technik <te...@jrsch.de>.
Hallo Christian,

ich fand das auch umständlich, aber das schien zu funktionieren. 
Zumindest auf dem Laptop
Aber jetzt habe ich das gleiche Programm auf dem Desktop ausgeführt und 
da ignoriert er die Seitenangabe.
Sehr seltsam. Auf beiden läuft 4.1.1 unter Win7.
Aber diese ganze uno:-Programmierung verstehe ich nur rudimentär.

Dein Programm lief zuerst nicht
Doc.storetoUrl(converttourl(Url),PrintProperties()) 'gibt Fehler 
Objektvariable nicht belegt
Ich habe noch ein Doc = ThisComponent am anfang eingefügt.
Public doc as object geht auch.

Den Rest kann ich mir anpassen. Vielen Dank.

Horst





Am 10.12.2015 um 15:50 schrieb Christian:
> technik <te...@jrsch.de> schrieb:
>
>> Wie kann ich nur Tab1 exportieren? (mit Makrobefehl)
>> Ich habe:
>> dim args2(2) as new com.sun.star.beans.PropertyValue
>> [viele viele Zeilen gelöscht]
> Aua, irgendwie extrem umständlich, finde ich.
>
> sub Export
> druckbereich("Plan","$A$1:$Q$28")
> url ="c:\temp.pdf"
> Dim PrintProperties(0) As New com.sun.star.beans.PropertyValue
> PrintProperties(0).Name="FilterName"
> PrintProperties(0).Value = "calc_pdf_Export"
> Doc.storetoUrl(converttourl(Url),PrintProperties())
> end sub
>
> sub druckbereich(blatt,bereich)
> Doc = ThisComponent
> Dim Druckbereich(0)
> For i = 0 to Doc.Sheets.getCount() - 1
>    Doc.Sheets.getByIndex(i).setPrintareas(array())
> Next
> Sheet = Doc.Sheets.getByName(Blatt)
> ZellRange = Sheet.getCellRangeByName(Bereich)
> Druckbereich(0) = Sheet.createCursorByRange(ZellRange).RangeAddress
> Sheet.setPrintAreas(Druckbereich())
> end sub
>
> cu,
> Christian
>
> PGP Key available.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-de-unsubscribe@openoffice.apache.org
> For additional commands, e-mail: users-de-help@openoffice.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-de-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-de-help@openoffice.apache.org


Re: uno:ExportToPDF

Posted by Christian <ch...@soemtron.de>.
technik <te...@jrsch.de> schrieb:

> Wie kann ich nur Tab1 exportieren? (mit Makrobefehl)

> Ich habe:
> dim args2(2) as new com.sun.star.beans.PropertyValue

> [viele viele Zeilen gelöscht]

Aua, irgendwie extrem umständlich, finde ich.

sub Export
druckbereich("Plan","$A$1:$Q$28")
url ="c:\temp.pdf"
Dim PrintProperties(0) As New com.sun.star.beans.PropertyValue
PrintProperties(0).Name="FilterName"
PrintProperties(0).Value = "calc_pdf_Export"
Doc.storetoUrl(converttourl(Url),PrintProperties())
end sub

sub druckbereich(blatt,bereich)
Doc = ThisComponent
Dim Druckbereich(0)
For i = 0 to Doc.Sheets.getCount() - 1
  Doc.Sheets.getByIndex(i).setPrintareas(array())
Next
Sheet = Doc.Sheets.getByName(Blatt)
ZellRange = Sheet.getCellRangeByName(Bereich)
Druckbereich(0) = Sheet.createCursorByRange(ZellRange).RangeAddress
Sheet.setPrintAreas(Druckbereich())
end sub

cu,
Christian

PGP Key available.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-de-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-de-help@openoffice.apache.org