Lieber Besucher, herzlich willkommen bei: Ubuntu-Forum & Kubuntu-Forum | www.Ubuntu-Forum.de.
Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert.
Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können.
Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang.
Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.
Doc2txt Konverter Script
Hallo,
ich möchte mir ein Script erstellen mit dem ich eine Vielzahl (~200) von Word Dokumenten in txt Dateien konvertiere.
Dazu hab ich Antiword verwendet.
leider sind einige der Dateien sehr klein und deshlab kommt die Medlung
|
Quellcode
|
1
|
I'm afraid the text stream of this file is too small to handle.
|
siehe:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=307657
Kennt jemand ein alternatives Tool ?
Ansonsten würde ich ein OpenOffice Makro schreiben was diese Aufgabe löst, aber ein Shell Skript wäre mir lieber
Danke
Florian
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Flocke« (20.09.2008, 20:44)
Hallo.
Dazu hab ich Antiword verwendet.
Was ist denn Antiword?
Grüße, euer
Ovim-Obscurum
Was ist denn Antiword?
Ohh, also Antiword ist :
Antiword can convert the documents from Microsoft Word version 2, 6, 7, 97, 2000, 2002 and 2003 to plain text, PostScript, PDF, and XML/DocBook . (Quelle: Wikipedia)
..........
So habs dann doch mit ooO Basic Makros gelöst.
Wen's interessiert (nicht sehr schön aber es funktioniert [Danke an Dannenhöfer's Basic FAQ] ) :
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
REM ***** ooO 2.4.1 ***** BASIC *****
Sub Main
oUCB = createUnoService("com.sun.star.ucb.SimpleFileAccess")
sValue = Dir$("/home/flo/",16)
Do
if Left (sValue, 1) <> "." and sValue <> "file:" then
msgbox(sValue)
DocDir (sValue)
end if
sValue = Dir$
Loop Until sValue = ""
End sub
Sub DocDir(Verz as String)
oUCB = createUnoService("com.sun.star.ucb.SimpleFileAccess")
Datei = "/home/flo/" + Verz + "/Datenblatt.doc"
if FileExists (Datei) then
DateiOeffnen(Datei)
end if
End Sub
Sub DateiOeffnen (dat as String)
url=converttourl(dat)
dim myFileProp as Object
dim args(0) as New com.sun.star.beans.PropertyValue
args(0).Name = "DocumentTitle"
args(0).Value = ""
oDocument = StarDesktop.loadComponentFromURL(url, "_blank", 0, args)
doc2txt (dat)
odoc=thisComponent
odoc.close(false)
end sub
sub doc2txt (pfad as String)
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file://" + Left(pfad, LEN (pfad) - 4) + ".txt"
args1(1).Name = "FilterName"
args1(1).Value = "Text"
args1(2).Name = "SelectionOnly"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())
end sub
|
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Flocke« (20.09.2008, 20:42)