uno

When to import uno

假装没事ソ 提交于 2020-01-04 13:22:48
问题 Using Ubuntu 12.04 and LibreOffice 3.5.7.2. I am trying to understand Python scripting in Libre Office. I've read quite a bit on the web and looked at and run some examples. I noticed that some examples import uno and some don't. They all run fine, but if I comment out import uno, that script stops working. Could someone explain to me when uno needs to be imported. Thanks, Jim 回答1: Try just importing uno. At the very most it will slow your program by 2 seconds. import uno ##JUST DO It! 回答2:

OpenOffice with .NET: how to iterate throught all paragraphs and read text

对着背影说爱祢 提交于 2019-12-23 16:17:57
问题 How to iterate through all paragraphs in OpenOffice Writer document and output text. I have Java examples, but don't know how to convert code to C#. Java example could be found here: http://wiki.services.openoffice.org/wiki/API/Samples/Java/Writer/TextDocumentStructure My C# code: InitOpenOfficeEnvironment(); XMultiServiceFactory multiServiceFactory = connect(); XComponentLoader componentLoader = XComponentLoader)multiServiceFactory.createInstance("com.sun.star.frame.Desktop"); //set the

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

How do I programmatically save a document in OpenOffice.org?

时间秒杀一切 提交于 2019-12-13 12:30:18
问题 I'd like to save a TextDocument created through OpenOffice.org UNO to a file on the disk. What is the best way to do this? Edit: This is the C# code that I ended up using. document is an XTextDocument . protected void Save (string path) { string url = "file://" + path; PropertyValue [] propertyValues = { new PropertyValue { Name = "FilterName", Value = new Any ("writer8") } }; ((XStorable) document).storeAsURL (url, propertyValues); } 回答1: Use XStorable.storeToURL() (or storeAsURL). Edit: You

Pyuno indexing issue that I would like an explanation for

喜你入骨 提交于 2019-12-13 06:05:24
问题 The following python libreoffice Uno macro works but only with the try..except statement. The macro allows you to select text in a writer document and send it to a search engine in your default browser. The issue, is that if you select a single piece of text, oSelected.getByIndex(0) is populated but if you select multiple pieces of text oSelected.getByIndex(0) is not populated. In this case the data starts at oSelected.getByIndex(1) and oSelected.getByIndex(0) is left blank. I have no idea

OpenOffice writer - programmatically updating tables with cell formulas

若如初见. 提交于 2019-12-12 12:17:15
问题 I'm really stuck trying to find out how to force a programmatic refresh of openoffice writer (3.3) cell calculations when the cell values are bookmarks and the bookmarks are updated programmatically (via UNO calls in Java). Example | start | stop | duration | | 9:30 | 11:30 | = <A2>-<B2> | <= cell formula This works fine when the user is manually editing the table, the value is updated when they move to the next cell. However if I update the values programmatically by inserting text into

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

fine tuning a goto bookmark libreoffice macro

柔情痞子 提交于 2019-12-11 17:04:47
问题 I have a libreoffice macro to go to a certain bookmark ("qui") sub vai_qui ViewCursor = ThisComponent.CurrentController.getviewCursor() Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor ViewCursor.gotorange(Bookmark, False) end sub The problems are two: this is a libreoffice macro, and so it runs also with Calc and Base, and I'd like to avoid error messages in Calc and Base; With this macro the cursor go to the bookmark, but the focus of Writer is not on the cursor: I prefer to avoid

How do I write a python macro in libreoffice writer to send a receive data

谁都会走 提交于 2019-12-11 04:48:52
问题 I am working in libreoffice writer and need to send a request to another program that I know to be listening on a TCP port, which will return data that needs to be inserted into the current Writer document. The macro needs to allow the data to be inserted as normal open text or into a cell within a table in which the cursor is presently positioned. The UNO documentation is spectacularly unclear and difficult to navigate. 回答1: def fs2ClientdataDoc(*args): #get the doc from the scripting

Reading Openoffice Calc (.ods) programmatically using c#?

核能气质少年 提交于 2019-12-10 13:36:32
问题 I want to know if it is possible to read OpenOffice Calc spreadsheet programatically with c#, I can do this for Excel(.xls and .xlsx) but unable to find a solution for reading calc spreadsheet. Help me if anyone has solution. 回答1: ODF .NET - It works for c# and you can read and write. Says like this on there page: ODF .NET allows you to write applications to create, modify and parse text documents and spreadsheets. Supports all versions of .NET Framework, .NET Compact Framework and Mono. 回答2: