Hi Christoph,

wenn du Deiner Bekannten ein Macro installieren kannst?!?

Christoph Noack schrieb:
Gegebenenfalls geht auch ein (z. B.) Bash-Skript, für dessen Erstellung
ich aber zu ungeübt bin. Das wäre aber schon fast eine Frage an die
dev-Liste, bis jetzt sehe ich das mal als Anwender-Frage :-) Denn
aktuell soll die Lösung durch meine Bekannte ja selber zu nutzen sein.


Macro Code ------------------- schnipp -------------------

' Revised: 2003-10-26-05

' This module displays Danny's Document Converter dialog.
'
' This dialog is an auto pilot that helps a user to convert
'  a batch of documents from one supported OOo import format
'  to another supported output OOo format.

'************************************************************
'    Copyright (c) 2003 Danny Brewer
'    Anyone may run this code.
'    If you wish to modify or distribute this code, then
'     you are granted a license to do so under the terms
'     of the Gnu Lesser General Public License.
'    See:  http://www.gnu.org/licenses/lgpl.html
'************************************************************
'
' Changes 2010 by Volker Heggemann
'
' no Dialog any more, just convert from one filetype to the other by constant informations
'


Sub BeginConversion_xls()

   dim odoc
' DIE VERZEICHNISSE ANPASSEN!

   cSourceFolder = ConvertToURL(  "C:\Eigene Dateien\openofficedocs")
cDestFolder = ConvertToURL( "C:\Eigene Dateien\openofficedocs\converted")

'Exportfilter für Wirter
'        cDestType = "SXW"
' cDestType = "STW" cExportFilter = "writer_StarOffice_XML_Writer_Template"
'        cDestType = "ODT"
'        cDestType = "PDF"        cExportFilter = "writer_pdf_Export"
'        cDestType = "DOC"        cExportFilter = "MS WinWord 6.0"
'        cDestType = "DOC"        cExportFilter = "MS Word 97"
'        cDestType = "DOC"        cExportFilter = "MS Word 97 Vorlage"
'        cDestType = "DOC"        cExportFilter = "MS Word 95"
'        cDestType = "DOC"        cExportFilter = "MS Word 95 Vorlage"
'        cDestType = "DOC"        cExportFilter = "Microsoft Word 2003 XML"
'        cDestType = "TXT"        cExportFilter = "Text"
'        cDestType = "RTF"        cExportFilter = "Rich Text Format"
'        cDestType = "HTML"        cExportFilter = "HTML (StarWriter)"
'        cDestType = "XHTML"        cExportFilter = "XHTML File"
'        cDestType = "XML"        cExportFilter = "Flat XML File"
'        cDestType = "XML"        cExportFilter = "DocBook File"
'Exportfilter für Calc
'        cDestType = "SXC"
' cDestType = "STC" cExportFilter = "calc_StarOffice_XML_Calc_Template"
'        cDestType = "ODS"
'        cDestType = "PDF"        cExportFilter = "calc_pdf_Export"
' cDestType = "XLS" cExportFilter = "MS Excel 97" ' cDestType = "XLS" cExportFilter = "MS Excel 97 Vorlage/Template"
'        cDestType = "XLS"        cExportFilter = "MS Excel 95"
' cDestType = "XLS" cExportFilter = "MS Excel 95 Vorlage/Template"
'        cDestType = "XLS"        cExportFilter = "MS Excel 5.0/95"
' cDestType = "XLS" cExportFilter = "MS Excel 5.0/95 Vorlage/Template"
'        cDestType = "XLS"        cExportFilter = "MS Excel 4.0"
' cDestType = "XLS" cExportFilter = "MS Excel 4.0 Vorlage/Template" ' cDestType = "CSV" cExportFilter = "Text - txt - csv (StarCalc)"
'        cDestType = "WKS"        cExportFilter = "Lotus"
'        cDestType = "DIF"        cExportFilter = "DIF"
'        cDestType = "SYLK"        cExportFilter = "SYLK"
'        cDestType = "DBF"        cExportFilter = "dBase"
'        cDestType = "HTML"        cExportFilter = "HTML (StarCalc)"

'Diese Zeile je nach Typ anpassen - für das Ausgabeformat
   cDestType = "XLS"
   cExportFilter = "MS Excel 97"

' Importfiler für Wirter
'        cSourceType = "SXW"
'        cSourceType = "STW"
'        cSourceType = "DOC"
'        cSourceType = "TXT"
'        cSourceType = "RTF"      cImportFilter = "Rich Text Format"
' cSourceType = "SGF" cImportFilter = "SGF - StarOffice Writer SGF"
'        cSourceType = "ODT"
'Importfiler für Calc
'        cSourceType = "SXC"
'        cSourceType = "XLS"
'        cSourceType = "ODS"
'        cSourceType = "CSV"
'        cSourceType = "WKS"         cImportFilter = "Lotus"
'        cSourceType = "DIF"          cImportFilter = "DIF"
'        cSourceType = "SYLK"        cImportFilter = "SYLK"
'        cSourceType = "DBF"          cImportFilter = "dBase"
'        cSourceType = "HTML"        cImportFilter = "HTML (StarCalc)"
' cSourceType = "RTF" cImportFilter = "Rich Text Format (StarCalc)"
'Importfiler für Impress
'        cSourceType = "SXI"
' cSourceType = "STI" cImportFilter = "impress_StarOffice_XML_Impress_Template"
'        cSourceType = "PPT"        cImportFilter = "MS PowerPoint 97"
' cSourceType = "PPT" cImportFilter = "MS PowerPoint 97 Vorlage" ' cSourceType = "SXD" cImportFilter = "impress_StarOffice_XML_Draw" ' cSourceType = "STD" cImportFilter = "impress_StarOffice_XML_Draw"
'        cSourceType = "ODP"
'Importfilter für Draw
'        cSourceType = "SXD"
'        cSourceType = "STD"
'        cSourceType = "ODG"
' cSourceType = "EMF" cImportFilter = "EMF - MS Windows Metafile"
'        cSourceType = "MET"        cImportFilter = "MET - OS/2 Metafile"
' cSourceType = "DXF" cImportFilter = "DXF - AutoCAD Interchange"
'        cSourceType = "SDA"        cImportFilter = "StarDraw 3.0"
'        cSourceType = "SDD"        cImportFilter = "StarDraw 3.0"
'        cSourceType = "VOR"        cImportFilter = "StarDraw 3.0 Vorlage"
'        cSourceType = "SGV"        cImportFilter = "SGV - StarDraw 2.0"
' cSourceType = "EPS" cImportFilter = "EPS - Encapsulated PostScript"
'        cSourceType = "PCT"        cImportFilter = "PCT - Mac Pict"
' Diese Zeilen anpassen für das Eingabeformat
   cSourceType = "ODS"
   cImportFilter = ""


oExportOptions = Array( MakePropertyValue( "FilterName", cExportFilter ) )
   If cImportFilter = "" Then
'        oImportOptions = Array()
       oImportOptions = Array(_
           MakePropertyValue( "Hidden", True )_
           )
   Else
       oImportOptions = Array(_
           MakePropertyValue( "Hidden", True ),_
           MakePropertyValue( "FilterName", cImportFilter )_
           )
   EndIf
   nNumFiles = CountSourceFiles()
oImportOptions = Array(MakePropertyValue( "Hidden", True ),MakePropertyValue( "FilterName", cImportFilter ))

   ' This is the actual conversion loop.
   nFileNum = 0
   cFile = Dir$( cSourceFolder + "/*." + LCase(cSourceType) )
   Do While cFile <> ""
       ' Update some stuff on the screen to keep the user entertained.
       nFileNum = nFileNum + 1

       ' Build the complete pathname to the source document.
       cSourceName = cSourceFolder + "/" + cFile
       ' Open the source document.
oDoc = StarDesktop.loadComponentFromURL( ConvertToUrl( cSourceName ), "_blank", 0,oImportOptions )

' Build the name of the new document -- with new suffix. cDestName = Left( cFile, Len( cFile ) - 4 )
       cDestName = cDestName + "." + LCase(cDestType)
       ' Build the URL of the new document.
       cDestURL = ConvertToUrl( cDestFolder + "/" + cDestName )
' Save the document in the new destination format.
       oDoc.storeToURL( cDestURL, oExportOptions )

       ' Close the document.
       oDoc.dispose()
' Get name of next file to convert.
       cFile = Dir$
   Loop
End Sub

'    Create and return a new com.sun.star.beans.PropertyValue.
'
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New 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

Macro Ende ---------------------- Schnapp ------------------


Testen nicht vergessen!

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Antwort per Email an