Convert pdf with visual basic OpenOffice Calc

Discuss the spreadsheet application

Convert pdf with visual basic OpenOffice Calc

Postby visomes » Mon Dec 10, 2018 6:51 pm

Good afternoon, how are you?
Has anyone used any commands below to convert an open office spreadsheet using visual basic.net? I'm trying to use it but with no success so far. If anyone can help, I'm grateful, thank you.


Code: Select all   Expand viewCollapse view
Sub exportaPDF()
        ' precisamos no mínimo da propriedade Filtro
        Dim oDoc As Object
        Dim sUrl As String
        Dim aProp(0) As New com.sun.star.beans.PropertyValue
        oDoc = thisComponent
        ' adapte para seu sistema
        sUrl = "c:\OOOexemplos\tst_PDF.pdf"
        sUrl = ConvertToURL(sUrl)
        ' define o filtro de exportação
        aProp(0).Name = "FilterName"
        aProp(0).Value = "writer_pdf_Export"
        ' para exportar use storeToURL
        oDoc.storeToURL(sUrl, aProp())
    End Sub
Open office 4.3.1
visomes
 
Posts: 11
Joined: Mon Aug 14, 2017 3:50 pm

Re: convert pdf with visual basic openOffice Calc

Postby Zizi64 » Mon Dec 10, 2018 7:15 pm

using visual basic.net?


The StarBasic - embedded in the AOO/LO - is not appropriate for you?
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.4 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.1.4 and AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 7602
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: convert pdf with visual basic openOffice Calc

Postby visomes » Mon Dec 10, 2018 7:35 pm

I could not find in the code something that meets what I need, which is to convert to pdf. Do you know how to do it?
Open office 4.3.1
visomes
 
Posts: 11
Joined: Mon Aug 14, 2017 3:50 pm

Re: convert pdf with visual basic openOffice Calc

Postby Zizi64 » Mon Dec 10, 2018 7:50 pm

What you want to convert?
- a whole .ods document?
- one sheet only?
- a selected cellrange only?

(You must use the same StoreTo() routine with spreadsheet-related parameters.)
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.4 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.1.4 and AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 7602
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: convert pdf with visual basic openOffice Calc

Postby RoryOF » Mon Dec 10, 2018 7:52 pm

Apache OpenOffice 4.1.6 on Xubuntu 18.04 (mostly 64 bit version) and infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 27951
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: convert pdf with visual basic openOffice Calc

Postby Lupp » Mon Dec 10, 2018 8:39 pm

LibreOffice / OpenOffice don't support VBA.

Conversion is done by the appropriate filter when storing TO (Not As!) a file.
The document itself remains unchanged and associated with the file it was loaded from (or used with stroeAs previously).
See https://stackoverflow.com/questions/305 ... o-pdf-file for an example.
It's basically the same with both branches though LibreOffice seems to be more active in developing/enhancing filters.

===Editing===
I just explored Q&D the names of arguments that were set for the respective .uno:ExportTo command used with the "calc_pdf_Export" filter of current LibreOffice (6.1.3). There were 52:
"UseLosslessCompression", "Quality", "ReduceImageResolution", "MaxImageResolution", "UseTaggedPDF", "SelectPdfVersion", "ExportNotes", "ViewPDFAfterExport", "ExportBookmarks", "OpenBookmarkLevels", "UseTransitionEffects", "IsSkipEmptyPages", "ExportPlaceholders", "IsAddStream", "FormsType", "ExportFormFields", "AllowDuplicateFieldNames", "HideViewerToolbar", "HideViewerMenubar", "HideViewerWindowControls", "ResizeWindowToInitialPage", "CenterWindow", "OpenInFullScreenMode". "DisplayPDFDocumentTitle", "InitialView", "Magnification", "Zoom", "PageLayout", "FirstPageOnLeft", "InitialPage", "Printing", "Changes", "EnableCopyingOfContent", "EnableTextAccessForAccessibilityTools", "ExportLinksRelativeFsys", "PDFViewSelection", "ConvertOOoTargetToPDFTarget", "ExportBookmarksToPDFDestination", "SignPDF", "_OkButtonString", "Watermark", "EncryptFile", "PreparedPasswords", "RestrictPermissions", "PreparedPermissionPassword", "SignatureLocation", "SignatureReason", "SignatureContactInfo", "SignaturePassword", "SignatureCertificate", "SignatureTSA", "UseReferenceXObject"
Probably there exist additional ones.
On Windows 10: LibreOffice 6.1 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Let's create a powerful UFO: United Free Office!
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2268
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany


Return to Calc

Who is online

Users browsing this forum: No registered users and 26 guests