pyuno

Search strings and line breaks with pyUNO

∥☆過路亽.° 提交于 2020-01-30 08:52:20
问题 I would like to delete a specific string from a document. I manage to delete the content of the string, but the line break still remains after. I found some things about ControlCharacters but it seems they are only numeric constants. Is it actually useful? This works. r = oDoc.createReplaceDescriptor() r.setSearchString("FOOBAR") r.setReplaceString("OTHERSTUFF") oDoc.replaceAll(r) This does not r = oDoc.createReplaceDescriptor() r.setSearchString("FOOBAR\n") r.setReplaceString("OTHERSTUFF")

Loading a document on OpenOffice using an external Python program

╄→尐↘猪︶ㄣ 提交于 2020-01-01 10:06:14
问题 I'm trying to create a python program (using pyUNO ) to make some changes on a OpenOffice calc sheet. I've launched previously OpenOffice on "accept" mode to be able to connect from an external program. Apparently, should be as easy as: import uno # get the uno component context from the PyUNO runtime localContext = uno.getComponentContext() # create the UnoUrlResolver resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext) #

OpenOffice.org development with pyUno for Windows—which Python?

浪子不回头ぞ 提交于 2019-12-19 02:46:10
问题 At home, on Linux, I've experimented with pyUNO to control OpenOffice.org using Python. I've been using Python 2.6. It all seems to work nicely. Now I thought I would try one of my scripts (run a graphical diff for ODF doc) on Windows. But when I tried to run it, I got: ImportError: No module named uno According to udk: Python UNO Bridge and OpenOffice.org Running Python on Windows, I have to run the Python interpretter that's installed with OpenOffice.org. Q1: Is Python 2.6 available for

Sorting cell range in a calc document with pyuno

好久不见. 提交于 2019-12-13 02:03:39
问题 With pyuno I open a LibreOffice calc document, I define a range of cells and I want to sort it. Here is the code: import os import uno # open a calc document # (it is assumed that LibreOffice is launched with the command line: # soffice -accept="socket,host=localhost,port=2002;urp") local = uno.getComponentContext() resolver = local.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local) context = resolver.resolve("uno:socket,host=localhost,port=2002;urp

Using pyUno to write text into Libre/OpenOffice Writer

风流意气都作罢 提交于 2019-12-12 04:38:02
问题 I am trying to export some text from Python into a Libre/OpenOffice Writer document which I created according to these instructions. For example, using cursor.setPropertyValue("CharHeight", 20) cursor.setPropertyValue("CharWeight", 150) document.Text.insertString(cursor, "This Is Heading One", 0) I can make a line of text look like a heading, but it's just text and not an actual heading. What property values do I have to modify to generate a heading line that's picked up for the TOC? In

OpenOffice pyuno “select all”

断了今生、忘了曾经 提交于 2019-12-07 05:15:19
问题 Does anyone know how to use the OO uno bridge api to "select all" in a Calc sheet? Alternatively, finding the maximum used row and column number would work. What I want to do is apply a format to all the cells in the spreadsheet. (The reason being that I'm saving the sheet as csv, so numbers are not accurately saved unless the format provides enough decimal places.) 回答1: Assuming you have already connected to OpenOffice and document is a spreadsheet that has been opened or created. #get the

OpenOffice pyuno “select all”

旧时模样 提交于 2019-12-05 09:13:19
Does anyone know how to use the OO uno bridge api to "select all" in a Calc sheet? Alternatively, finding the maximum used row and column number would work. What I want to do is apply a format to all the cells in the spreadsheet. (The reason being that I'm saving the sheet as csv, so numbers are not accurately saved unless the format provides enough decimal places.) Assuming you have already connected to OpenOffice and document is a spreadsheet that has been opened or created. #get the sheet you want to work with, I'm just going to grab the first sheet sheets = document.getSheets()

Using pyuno with my existing python installation

☆樱花仙子☆ 提交于 2019-12-05 04:29:02
问题 I'm trying to use PyUNO as a method to convert different document formats (doc, wordperfect, html, etc) to PDF from within my Django server. I'm having a heck of a time getting import uno to work. It seems to fail when doing import pyuno , with a message of ImportError: DLL Load Failed: The specified module could not be found . The only way I can get this to work is to use the Python 2.6 that came with OpenOffice, but I really want to use my other 2.6 installation. The docs for PyUNO are all

Using pyuno with my existing python installation

爷,独闯天下 提交于 2019-12-03 21:14:17
I'm trying to use PyUNO as a method to convert different document formats (doc, wordperfect, html, etc) to PDF from within my Django server. I'm having a heck of a time getting import uno to work. It seems to fail when doing import pyuno , with a message of ImportError: DLL Load Failed: The specified module could not be found . The only way I can get this to work is to use the Python 2.6 that came with OpenOffice, but I really want to use my other 2.6 installation. The docs for PyUNO are all for Python 2.2, and reputed to be out-of-date. I'm guessing that some (or all) of the following files

Search strings and line breaks with pyUNO

↘锁芯ラ 提交于 2019-12-02 08:10:42
I would like to delete a specific string from a document. I manage to delete the content of the string, but the line break still remains after. I found some things about ControlCharacters but it seems they are only numeric constants. Is it actually useful? This works. r = oDoc.createReplaceDescriptor() r.setSearchString("FOOBAR") r.setReplaceString("OTHERSTUFF") oDoc.replaceAll(r) This does not r = oDoc.createReplaceDescriptor() r.setSearchString("FOOBAR\n") r.setReplaceString("OTHERSTUFF") oDoc.replaceAll(r) r = oDoc.createReplaceDescriptor() r.setSearchString("FOOBAR\r") r.setReplaceString(