# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # This file incorporates work covered by the following license notice: # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed # with this work for additional information regarding copyright # ownership. The ASF licenses this file to you under the Apache # License, Version 2.0 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . #
import getopt import sys import uno
from unohelper import Base,systemPathToFileUrl from os import getcwd from com.sun.star.beans import PropertyValue from com.sun.star.uno import Exception as UnoException from com.sun.star.io import IOException, XOutputStream
class OutputStream(Base, XOutputStream): def __init__(self):
self.closed = 0
try:
opts, args = getopt.getopt(sys.argv[1:], "hc:", ["help", "connection-string=", "html"])
url = "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
filterName = "Text (Encoded)" for o, a in opts: if o in ("-h", "--help"):
usage()
sys.exit() if o in ("-c", "--connection-string"):
url = "uno:" + a + ";urp;StarOffice.ComponentContext" if o == "--html":
filterName = "HTML (StarWriter)"
def usage():
sys.stderr.write("usage: ooextract.py --help |\n"+ " [-c | --connection-string=\n"+ " file1 file2 ...\n"+ "\n" + "Extracts plain text from documents and prints it to stdout.\n" + "Requires an OpenOffice.org instance to be running. The script and the\n"+ "running OpenOffice.org instance must be able to access the file with\n"+ "by the same system path.\n" "\n"+ "-c | --connection-string=\n" + " The connection-string part of a UNO URL to where the\n" + " the script should connect to in order to do the conversion.\n" + " The strings defaults to socket,host=localhost,port=2002\n" "--html \n" " Instead of the text filter, the writer html filter is used\n"
)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.