{ "info": { "author": "Tetsuya Morimoto", "author_email": "tetsuya dot morimoto at gmail dot com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Office/Business :: Office Suites", "Topic :: Software Development", "Topic :: Software Development :: Libraries" ], "description": "unotools\n========\n\nUnoTools allows you to interact with OpenOffice.org/LibreOffice using\nthe \"UNO bridge\". The aim is to make handling OpenDocument easy than\nusing the original UNO/PyUNO for scripting.\n\nThe unotools is quite simple, but you ought to understand UNO APIs.\n\n- `The Apache OpenOffice API\n Document `__\n- `UNO `__\n- `PyUNO `__\n\nThere're other tools.\n\n- `pyoo `__\n- `unoconv `__\n\nHow to install\n--------------\n\nRequirements\n~~~~~~~~~~~~\n\n- OpenOffice.org/LibreOffice 3.4 or lator\n- Python 3.3 or lator\n\nOn Ubuntu 14.04\n~~~~~~~~~~~~~~~\n\nInstall libreoffice, uno library and python3:\n\n.. code:: bash\n\n $ sudo aptitude install -y libreoffice libreoffice-script-provider-python uno-libs3 python3-uno python3\n\nI like virtualenvwrapper to make temporary environment:\n\n.. code:: bash\n\n $ sudo aptitude install -y virtualenvwrapper\n $ mkvirtualenv -p /usr/bin/python3.4 --system-site-packages tmp3\n\nConfirm importing uno module:\n\n.. code:: bash\n\n (tmp3)$ python \n Python 3.4.0 (default, Apr 11 2014, 13:05:11) \n [GCC 4.8.2] on linux\n Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n >>> import uno\n\nInstall unotools from PyPI:\n\n.. code:: bash\n\n (tmp3)$ pip install unotools\n\nOn Mac OS X\n~~~~~~~~~~~\n\nDownload LibreOffice DMG package from https://www.libreoffice.org/ and\ninstall.\n\n.. code:: bash\n\n $ hg clone ssh://hg@bitbucket.org/t2y/unotools\n\nIn Python 3.3 case, need singledispatch package. Confirm Python\ninterpreter version included in LibreOffice.\n\n.. code:: bash\n\n $ hg clone ssh://hg@bitbucket.org/ambv/singledispatch\n\nSet *PYTHONPATH* to resolve additional packages in LibreOffice's Python\ninterpreter.\n\n.. code:: bash\n\n $ export PYTHONPATH=\"/path/to/singledispatch/:/path/to/unotools/\"\n\nOn Mac OS X, soffice and python commands are as below.\n\n.. code:: bash\n\n $ /Applications/LibreOffice.app/Contents/MacOS/soffice --version\n LibreOffice 4.4.0.3 de093506bcdc5fafd9023ee680b8c60e3e0645d7\n\nConfirm importing unotools package:\n\n.. code:: bash\n\n $ /Applications/LibreOffice.app/Contents/MacOS/python\n Python 3.3.5 (default, Jan 22 2015, 17:12:45) \n [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin\n Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n >>> import unotools\n\nHow to use (on Ubuntu 14.04)\n----------------------------\n\nStartup libreoffice:\n\n.. code:: bash\n\n (tmp3)$ soffice --accept='socket,host=localhost,port=8100;urp;StarOffice.Service'\n\nDownload sample-scripts from\nhttps://bitbucket.org/t2y/unotools/raw/default/sample-scripts:\n\n.. code:: bash\n\n (tmp3)$ python sample-scripts/writer-sample1.py -s localhost\n (tmp3)$ python sample-scripts/calc-sample1.py -s localhost -d sample-scripts/datadir/\n (tmp3)$ ls\n sample-calc.html sample-calc.pdf sample-calc_html_eaf26d01.png\n sample-scripts sample-writer.html sample-writer.pdf\n sample.csv sample.doc sample.ods sample.odt sample.xls\n\nThere's a sample script to convert odt/ods to pdf.\n\n.. code:: bash\n\n (tmp3)$ python sample-scripts/pdf-convert-sample1.py -s localhost -f sample.odt\n (tmp3)$ python sample-scripts/pdf-convert-sample1.py -s localhost -f sample.ods\n (tmp3)$ ls sample.pdf\n\nLook through these sample script, then it help you how to use unotools.\n\nInteract with interpreter step by step\n--------------------------------------\n\nInteracting documents with UNO make you learn how to use unotools.\n\nStartup LibreOffice:\n\n.. code:: bash\n\n $ soffice --accept='socket,host=localhost,port=8100;urp;StarOffice.Service'\n\n.. code:: python\n\n >>> from unotools import Socket, connect\n >>> from unotools.component.writer import Writer\n >>> context = connect(Socket('localhost', 8100))\n >>> writer = Writer(context)\n\nNow, you can see new document window on LibreOffice.\n\n.. code:: python\n\n >>> writer.set_string_to_end('Hello\\n')\n >>> writer.set_string_to_end('World\\n')\n\nThen, *Hello* and *World* are put into the document window.\n\n.. code:: python\n\n >>> text = writer.text\n >>> text\n \n\nWriter inherits\n`XTextRange `__\ninterface and has those methods. To make full use of unotools, you have\nto understand UNO APIs.\n\nThere's a tip to confirm what methods are exist in the component. The\n``_show_attributes()`` is a helper method that unotools component\ninherit.\n\n.. code:: python\n\n >>> text._show_attributes()\n [ ...\n 'getElementType',\n 'getEnd',\n 'getImplementationId',\n 'getImplementationName',\n 'getPropertySetInfo',\n 'getPropertyValue',\n 'getSomething',\n 'getStart',\n 'getString',\n 'getSupportedServiceNames',\n 'getText',\n 'getTypes',\n ...\n ]\n\nThough these methods are CamelCase, you can also invoke Python style\nmethods.\n\n.. code:: python\n\n >>> text.getString()\n 'Hello\\nWorld\\n'\n\n >>> text.get_string()\n 'Hello\\nWorld\\n'\n\nBoth are same method and unotools component handles to convert Python\nstyle to original method.\n\nLet's save this document as *odt*.\n\n.. code:: python\n\n >>> from unotools.unohelper import convert_path_to_url\n >>> url = convert_path_to_url('./test1.odt')\n >>> url\n 'file:///Users/t2y/work/repo/unotools/test1.odt'\n >>> writer.store_to_url(url, 'FilterName', 'writer8')\n >>> writer.close(True)\n\nIf you want to read OpenDocument on file system, like this.\n\n.. code:: python\n\n >>> writer = Writer(context, convert_path_to_url('./test1.odt'))\n\n\nChangeLog\n---------\n\n0.3.3 (2015-03-21)\n~~~~~~~~~~~~~~~~~~\n\n- added PDF conversion sample script\n- updated README as tutorial\n\n0.3.2 (2014-06-07)\n~~~~~~~~~~~~~~~~~~\n\n- added some classes for calc\n- changed data directory option of command line argument (-d,\n --datadirs) to be able to store multiple directories\n\n0.3.1 (2014-05-07)\n~~~~~~~~~~~~~~~~~~\n\n- added command line argument (-f, --file) to be able to read\n OpenDocument file\n\n0.3.0 (2014-05-05)\n~~~~~~~~~~~~~~~~~~\n\n- first release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/t2y/unotools", "keywords": "uno,pyuno,office,OOo", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "unotools", "package_url": "https://pypi.org/project/unotools/", "platform": "unix,linux,osx", "project_url": "https://pypi.org/project/unotools/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://bitbucket.org/t2y/unotools" }, "release_url": "https://pypi.org/project/unotools/0.3.3/", "requires_dist": null, "requires_python": null, "summary": "Interacting with OpenOffice.org/LibreOffice using UNO", "version": "0.3.3" }, "last_serial": 1471020, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "ccaa2ad75a9fc7a81a871d4ad1db14ee", "sha256": "685d832c80ca613c9b360f334d33239c6f10f834c595243c51c10907db957f3d" }, "downloads": -1, "filename": "unotools-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ccaa2ad75a9fc7a81a871d4ad1db14ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12670, "upload_time": "2014-05-05T10:13:58", "url": "https://files.pythonhosted.org/packages/37/93/cd12bc29925d1b7e291663457ac9049506a46a1ff22010ef72ac16e30162/unotools-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "8bf7ab9eaa8cb74834f0d0a9da303c5b", "sha256": "35b10f1be8467ec6a51154547393d0aa39fe970b3c1b769546409b894acf9c49" }, "downloads": -1, "filename": "unotools-0.3.1.tar.gz", "has_sig": false, "md5_digest": "8bf7ab9eaa8cb74834f0d0a9da303c5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12378, "upload_time": "2014-05-06T23:48:16", "url": "https://files.pythonhosted.org/packages/30/71/c47801ea90807b3bb6c753f085e277afe67e8d7618ba35f106f9368e840f/unotools-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "161b205c2041a889ee58656324cbc044", "sha256": "912c7acba1eecf1265121e3308076297dc7360d9bc30bf54af616150af1d0b8f" }, "downloads": -1, "filename": "unotools-0.3.2.tar.gz", "has_sig": false, "md5_digest": "161b205c2041a889ee58656324cbc044", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13111, "upload_time": "2014-06-07T11:33:21", "url": "https://files.pythonhosted.org/packages/84/bc/4482b9e760cb4f6c09a1992d4c218764a83be21ce9b8404e93d12ab86bf9/unotools-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "b568ee2fdd87490f9630a81463990505", "sha256": "72190c70279977db7e60c620b54e8ade9f11e9113289e7728fe367014cbd268d" }, "downloads": -1, "filename": "unotools-0.3.3.tar.gz", "has_sig": false, "md5_digest": "b568ee2fdd87490f9630a81463990505", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17275, "upload_time": "2015-03-21T06:24:54", "url": "https://files.pythonhosted.org/packages/12/35/443632cfa43f82efd363bc8104b3ae67a887a248c6c6baec34c7b9edbcb5/unotools-0.3.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b568ee2fdd87490f9630a81463990505", "sha256": "72190c70279977db7e60c620b54e8ade9f11e9113289e7728fe367014cbd268d" }, "downloads": -1, "filename": "unotools-0.3.3.tar.gz", "has_sig": false, "md5_digest": "b568ee2fdd87490f9630a81463990505", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17275, "upload_time": "2015-03-21T06:24:54", "url": "https://files.pythonhosted.org/packages/12/35/443632cfa43f82efd363bc8104b3ae67a887a248c6c6baec34c7b9edbcb5/unotools-0.3.3.tar.gz" } ] }