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
REM eZ Publish document conversion macros
Sub convertToOOo(strFile as string, strDestFile as string)
Address: https://doc.exponential.earth/exphelp/viewer/ext/ezodf/eZconversion.txt
Documentation license
This page is part of the documentation of the extension ezodf and is distributed under the license of that extension.