Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

REM eZ Publish document conversion macros

Sub convertToOOo(strFile as string, strDestFile as string)

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/ext/ezodf/eZconversion.txt

REM  eZ Publish document conversion macros

Sub convertToOOo(strFile as string, strDestFile as string)

    On Error GOTO ErrorHandler
    
    Dim oDoc as Object
    Dim strFilterSubName as String

    strUrl = ConvertToUrl( strFile )
    oDoc = StarDesktop.loadComponentFromURL( strUrl, "_blank", 0, array(MakePropertyValue("Hidden",true)))
    oDoc.storeToUrl( ConvertToUrl( strDestFile ), Array())
    oDoc.close(True)
    Exit Sub

ErrorHandler:
    Shell("/bin/echo", 0, "Error " & Err & ": " & Error$ & " (line : " & Erl & ")" )
    Shell("/bin/echo", 0, "Tried to convert file from:" + strFile + " To: " + strDestFile )
    
End Sub

Sub convertToPDF(strFile as string, strDestFile as string)

    On Error GOTO ErrorHandler

    Dim oDoc as Object
    Dim strFilterSubName as String

    strUrl = ConvertToUrl( strFile )
    oDoc = StarDesktop.loadComponentFromURL( strUrl, "_blank", 0, array(MakePropertyValue("Hidden",true)))

    cURL = ConvertToURL( strDestFile )

    oDoc.storeToURL( cURL, Array( MakePropertyValue( "FilterName", "writer_pdf_Export" ) )

    oDoc.close(True)
    Exit Sub

ErrorHandler:
    Shell("/bin/echo", 0, "Error " & Err & ": " & Error$ & " (line : " & Erl & ")" )
    Shell("/bin/echo", 0, "Tried to convert file from:" + strFile + " To: " + strDestFile )

End Sub

Sub convertToDoc(strFile as string, strDestFile as string)
    On Error GOTO ErrorHandler
    
    Dim oDoc as Object
    Dim strFilterSubName as String

    strUrl = ConvertToUrl( strFile )
    oDoc = StarDesktop.loadComponentFromURL( strUrl, "_blank", 0, array(MakePropertyValue("Hidden",true)))

    cURL = ConvertToURL( strDestFile )

    oDoc.storeToURL( cURL, Array( MakePropertyValue( "FilterName", "MS Word 97" ) )

    oDoc.close(True)
    Exit Sub

ErrorHandler:
    Shell("/bin/echo", 0, "Error " & Err & ": " & Error$ & " (line : " & Erl & ")" )
    Shell("/bin/echo", 0, "Tried to convert file from:" + strFile + " To: " + strDestFile )

End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
    oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
    If Not IsMissing( cName ) Then
       oPropertyValue.Name = cName
    EndIf
    If Not IsMissing( uValue ) Then
       oPropertyValue.Value = uValue
    EndIf
    MakePropertyValue() = oPropertyValue
End Function

Something wrong on this page? Report an error

Documentation license

This page is part of the documentation of the extension ezodf and is distributed under the license of that extension.