# pylibreoffice
A Python library for handling Microsoft Office documents, built with [LibreOfficeKit](https://docs.libreoffice.org/libreofficekit.html).
## Features
- Convert Microsoft Office documents to PDF
## Installation
### Requirements
- Python 3.10 or higher
- LibreOffice 7.2 or higher
```bash
sudo apt-get install -y libreoffice libreoffice-dev libreoffice-dev-doc
```
- The fonts used in the document must be installed on the system.For example,use Chinese, on Ubuntu, you can install the fonts by running the following command:
```bash
sudo apt-get install -y fonts-wqy-zenhei fonts-wqy-microhei xfonts-intl-chinese ttf-wqy-zenhei ttf-wqy-microhei language-pack-zh-hans language-pack-zh-hant && \
sudo dpkg-reconfigure locales && \
sudo update-locale LANG=zh_CN.UTF-8
```
```bash
pip install pylibreoffice
```
## Example
```python
from pylibreoffice.py_office import PyOffice
class Example:
def __init__(self):
self.office = PyOffice("/usr/lib/libreoffice/program/")
def doc(self):
# Convert the doc file to pdf
print(self.office.save_as("./test.doc", "./test.pdf", "pdf"))
def xls(self):
# Convert the xls file to pdf
print(self.office.save_as("./test.xls", "./test_xls.pdf", "pdf"))
if __name__ == '__main__':
ex = Example()
ex.xls()
ex.doc()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/begonia-org/pylibreoffice",
"name": "pylibreoffice",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "office, libreoffice, doc, ppt, xls, docx, xlsx, pptx, pdf, libreofficekit, cython, pybind11",
"author": "vforfreedom",
"author_email": "vforfreedom <vforfreedom96@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/4f/96/6233f0707334b2316ec3cf23f8ce692ddfc126e41cd57e5dec9ba30229ee/pylibreoffice-0.1.3.tar.gz",
"platform": "Linux",
"description": "# pylibreoffice\n\nA Python library for handling Microsoft Office documents, built with [LibreOfficeKit](https://docs.libreoffice.org/libreofficekit.html).\n\n## Features\n\n- Convert Microsoft Office documents to PDF\n\n## Installation\n### Requirements\n- Python 3.10 or higher\n\n- LibreOffice 7.2 or higher\n```bash\nsudo apt-get install -y libreoffice libreoffice-dev libreoffice-dev-doc\n```\n\n- The fonts used in the document must be installed on the system.For example,use Chinese, on Ubuntu, you can install the fonts by running the following command:\n```bash\nsudo apt-get install -y fonts-wqy-zenhei fonts-wqy-microhei xfonts-intl-chinese ttf-wqy-zenhei ttf-wqy-microhei language-pack-zh-hans language-pack-zh-hant && \\\nsudo dpkg-reconfigure locales && \\\nsudo update-locale LANG=zh_CN.UTF-8\n```\n\n```bash\npip install pylibreoffice\n```\n\n## Example\n\n```python\nfrom pylibreoffice.py_office import PyOffice\n\n\nclass Example:\n def __init__(self):\n self.office = PyOffice(\"/usr/lib/libreoffice/program/\")\n\n def doc(self):\n # Convert the doc file to pdf\n print(self.office.save_as(\"./test.doc\", \"./test.pdf\", \"pdf\"))\n\n def xls(self):\n # Convert the xls file to pdf\n print(self.office.save_as(\"./test.xls\", \"./test_xls.pdf\", \"pdf\"))\n\n\nif __name__ == '__main__':\n ex = Example()\n ex.xls()\n ex.doc()\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for handling Microsoft Office documents, built with LibreOfficeKit.",
"version": "0.1.3",
"project_urls": {
"Documentation": "https://github.com/begonia-org/pylibreoffice",
"Homepage": "https://github.com/begonia-org/pylibreoffice",
"Issues": "https://github.com/begonia-org/pylibreoffice/issues",
"Repository": "https://github.com/begonia-org/pylibreoffice.git"
},
"split_keywords": [
"office",
" libreoffice",
" doc",
" ppt",
" xls",
" docx",
" xlsx",
" pptx",
" pdf",
" libreofficekit",
" cython",
" pybind11"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4f966233f0707334b2316ec3cf23f8ce692ddfc126e41cd57e5dec9ba30229ee",
"md5": "095d7b61fff9cdd6b99ea8c5d62478de",
"sha256": "11d8d702251064c1d531aaa755f92adb198e0451a5d244645bb2d29a5957087f"
},
"downloads": -1,
"filename": "pylibreoffice-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "095d7b61fff9cdd6b99ea8c5d62478de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 66822,
"upload_time": "2024-12-02T03:08:47",
"upload_time_iso_8601": "2024-12-02T03:08:47.854895Z",
"url": "https://files.pythonhosted.org/packages/4f/96/6233f0707334b2316ec3cf23f8ce692ddfc126e41cd57e5dec9ba30229ee/pylibreoffice-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-02 03:08:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "begonia-org",
"github_project": "pylibreoffice",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pylibreoffice"
}