質問する

# hunteke's profile - activity

 2015-11-02 00:16:14 +0200 ベストアンサーマーク Manual calculation of circular references in Calc? In Excel, I can set the workbook to automatically calculate, or manually calculate based on my input (e.g. with F9). As it is often used with circular references, this is very useful for creating, among other things, animations with graphs. Here are the relevant MS Excel options (v2007): The key notion that I'm after is handling circular references based on iterations. For example, let's assume AutoCalculate is off (Tools->Cell Contents->AutoCalculate [unchecked]), that Iterations are enabled with a step of 1 (Tools->Options->Libreoffice Calc->Calculate), and that I first put this into cells A1 through B2:  | A | B -------------- 1 | dt =| 0.1 2 | t =| 0.0  I now change cell B2 to the formula "=B1 + B2":  | A | B ------------------ 1 | dt =| 0.1 2 | t =| =B1 + B2  But because AutoCalculate is off, the value shown should remain 0.0. Despite the circular reference, if I do this exercise in MS Excel, I can press F9, and B2 will update to 0.1. If I press F9 again, it updates to 0.2, and so on. Currently, however, when I change the cell B2 as above, Calc first returns '#VALUE!'. When I then press F9, cell B2 then contains 'ERR:523'. How can I recreate manual calculation with circular (and self!) references with LibO? 2015-05-28 01:43:02 +0200 バッジを受け取った ● 体系学者 2014-08-26 06:34:38 +0200 質問に回答する How to disable any feature of libreoffice and build it again on Linux This is a question better suited for the development list. If you still have not figured out the answer to your question in the intervening 16 months, then consider joining the developer's mailing list. Search for "Mailing List" on the Developers page. 2014-08-26 06:27:26 +0200 質問に回答する LibreOffice crashes on startup The correct response to your question is: given that LibO most certainly starts on other distros, and works on a fresh install of OpenSuSE, this "question" should be a bug report to OpenSUSE's update process, not a post on this forum. Unfortunately, not all Linux distributions (read: most) do well at upgrading; though it works most of the time, there is a large enough percentage of things that don't quite go as planned that my general advice to people is simply to install new distro versions afresh rather than upgrading between them. If you at least separated your system and your data into different partitions (e.g., / to /dev/sda1; /home to /dev/sda2) when you originally installed the system, then it should be relatively easy to update your system in place without destroying your data. Meanwhile, OpenSUSE 13.1 is out now, and hopefully either upgrading again, or installing afresh will resolve your issue. 2014-08-26 05:56:22 +0200 コメント付き回答 How do I invoke IPython from a macro? @karolus: absolutely ... how? I just write answers or ask questions on this site. The (karma)points aren't where I'm focused. You are, however, so I'm happy to oblige ... but how? @sup: Py3: cool, then use Py3 (and you're right, as of 4.0 it seems!) 2014-08-25 18:56:48 +0200 コメント付き回答 How do I invoke IPython from a macro? @sup: regarding the XSCRIPTCONTEXT vs desktop ... I am not an expert, but I think it is the difference between an internal macro and an external script. With your macro, you're not connecting to LibO -- you're already in LibO's process space because LibO is running your macro. Both this and @karolus answer are connecting your Python script -- as an external process -- to LibO: two separate processes communicating. 2014-08-25 18:54:48 +0200 コメント付き回答 How do I invoke IPython from a macro? @sup: regarding Py3: use it if you have the luxury, but it is not a requirement (I don't think, anyway) with this use. This script is meant to run in its own process space and connect to LibO. This means that LibO doesn't care what is talking to it, just that it's speaking the correct language. That said, if the uno library is not Py2 compatible, then you are perhaps correct. Solution: go with what works. 2014-08-25 15:10:19 +0200 バッジを受け取った ● 素晴らしい回答 (source) 2014-08-24 23:47:32 +0200 コメント付き回答 How do I invoke IPython from a macro? I am unaware of the uno:pipe connection. I'll have to check that out! Meanwhile, I appreciate your use of the IPython Notebook. IPNB doesn't work for me (in terms of how I develop, not in terms of actual function), but I wonder if it will be more approachable (given the WUI) than the CLI interaction my answer proposes. @sup: please do try these both and let us know which works for your brain (perhaps by accepting one as the answer), or if IPython is just not for you. I'm curious! :-) 2014-08-24 02:07:50 +0200 バッジを受け取った ● 有名な質問 (source) 2014-08-24 01:59:03 +0200 質問に回答する How do I invoke IPython from a macro? The output above suggests you are trying to run your script from within LibO. That wouldn't be all that helpful, I think, because I believe your REPL would likely be hidden to you. My answer to the other question perhaps erroneously assumed you were connecting to LibO in a "remote context". Let me explain how to do that, in case it's helpful. Meanwhile, the answer to this question is "don't embed IPython within a script that you are executing from within LibreOffice". Now, to get you started in case you do want to utilize LibO via a remote connection... I do not know what operating system you are running, but the below set of commands assumes Ubuntu. Note that $ is the prompt, and should not be typed by you:  # From the raw command line, e.g., gnome-terminal, konsole, xterm$ sudo apt-get update # ensure you've the latest software indexes $apt-cache search ipython # see what packages with 'ipython' are available$ sudo apt-get install ipython # install the ipython package  The above just makes sure you've IPython available. The next starts LibO so that you can remotely connect to it: $libreoffice "--accept=socket,host=localhost,port=2002;urp;"  You can change that number to anything you like between 1025 and 65535 (assuming that port is not already in use by some other program), but 2002 seems to be the de facto LibO/OO choice. The next step is to get your Python script to connect to LibO on that port. Below is some boiler plate code to accomplish this: #!/usr/bin/env python from sys import stderr as SE # 'SE' because I'm a lazy git. from IPython import embed as II # 'II' because it's a personal script, and I'm lazy. try: # The order of these imports apparently matters. Who would have guessed? # Not me ... import pyuno import uno except ImportError: msg = ('Python bindings to pyuno or uno not found. Try setting the ' 'PYTHONPATH environment variable before running this script. Like:\n' ' export PYTHONPATH=/usr/lib/libreoffice/program\n' ) SE.write( msg ) raise SE.write( 'Connecting to Libreoffice ... '); SE.flush() localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext( 'com.sun.star.bridge.UnoUrlResolver', localContext ) connection_url = 'uno:socket,host=localhost,port=2002;urp;StarOffice.ServiceManager' # note that localhost means literally "this computer". You could just as # easily connect to any IP address with a waiting LibreOffice: #connection_url = 'uno:socket,host=10.0.0.103,port=2002;urp;StarOffice.ServiceManager' try: smgr = resolver.resolve( connection_url ) except: msg = ('\nUnable to connect to LibreOffice on port 2002. Either start LO' ' with\n' '\n$ libreoffice "--accept=socket,host=localhost,port=2002;urp;"\n' "\nor update this script's connection string with the correct port.\n") SE.write( msg ) raise remoteContext = smgr.getPropertyValue( 'DefaultContext' ) desktop = smgr.createInstanceWithContext( 'com.sun.star.frame.Desktop', remoteContext) SE.write( 'Success.'); SE.flush() # Now, start your REPL (read-evaluate-print-loop) while developing: SE.write( 'Starting the IPython REPL:\n\n' ); SE.flush() II() SE.write( '\n\nREPL exit. Continuing to execute ... 2014-08-24 01:14:41 +0200 バッジを受け取った ● 素晴らしい回答 (source) 2014-08-24 00:28:32 +0200 バッジを受け取った ● ネクロマンサー (source) 2014-07-15 13:54:13 +0200 バッジを受け取った ● ネクロマンサー (source) 2014-03-25 19:46:25 +0200 質問に回答する How can I create books through py-uno? The response to the first half of your question is: unfortunately, great documentation oriented toward the Python-UNO interface does not currently exist. A Python-LibO interface (in the form of UNO) certainly exists, as you have found, but it is neither robust, nor well-documented. Further, there does not seem to be anyone on the LibO dev list who is actively focused on this particular area. There are scant few functional tests of the Python-UNO interface (that ensure that changes do not unintentionally change user-facing APIs), and there does not appear to be any active development on this front. However, the Python-UNO interface is basically a veneer over the C++ APIs, as are the other language-level interfaces. Thus, if you can track down another language-level API for UNO, or have the ability read the C++ documentation and/or code, you may have some success translating for your use cases. Clearly, this is not ideal, and the best workaround I've come up with is targeted introspection of the API through use of a drop-in REPL shell. IPython works wonders for this purpose. Consider something like this (or more complete examples ): ctxt = pyuno.getComponentContext() smgr = ctxt.ServiceManager desktop = smgr.createInstanceWithContext('com.sun.star.frame.Desktop', ctxt) url = 'private:factory/swriter' doc = desktop.loadComponentFromURL( url, '_blank', 0, () ) from IPython import embed as II II() # <--- this creates a shell right "here", as if you had typed # the above commands. For example, try typing 'doc.[tab][tab]' # to see what IPython can find as possible accessible attributes # on the doc object.  My choice of "II" is clearly arbitrary, stemming from some measure of lazy. I often put the import statement at the top of a script, and then know that I can type "II()" anywhere I'd like to poke around. 3 letters and typos saved ... Having use of a REPL with the exact context of the program is really helpful. In my opinion, the IPython interface is "better" because it offers many additional "goodies" which many of the Python debugging packages don't. Finally, a plug: if you can create functional tests of issues you note with LibO, please do so and submit them. In general, I'd argue that LibO suffers from a weak set of unit and functional tests, and would benefit from folks such as yourself: drive-by coders who happen to notice errant behavior. 2014-03-18 06:31:53 +0200 コメント付き質問 Sort on more than 3 Col / .uno:DataSort If this is a question, please formulate it as such. If this is a bug report, please remove this "question" and open a bug report. 2014-02-04 03:41:15 +0200 バッジを受け取った ● 熱心な人 2014-01-30 02:51:36 +0200 バッジを受け取った ● ネクロマンサー (source) 2014-01-30 02:37:25 +0200 バッジを受け取った ● 良い回答 (source) 2014-01-30 00:09:56 +0200 バッジを受け取った ● 素晴らしい回答 (source) 2014-01-29 22:07:44 +0200 質問に回答する Lookup matching regular expression in Calc I do not know how @nb solved the problem, but I offer a solution to the problem as described with COUNTIF. There are only a handful of functions that interpret strings as regular expressions, and COUNTIF is one of them. So, treating 1 as a TRUE value, and 0 as a FALSE value:  A B Item Class apples1 =IF(COUNTIF(A2, ".*apple.*"), "apples", IF(COUNTIF(A2, ".*pear.*"), "pears", "other") apples2 =IF(COUNTIF(A3, ".*apple.*"), "apples", IF(COUNTIF(A3, ".*pear.*"), "pears", "other") apples3 =IF(COUNTIF(A4, ".*apple.*"), "apples", IF(COUNTIF(A4, ".*pear.*"), "pears", "other") Pear A =IF(COUNTIF(A5, ".*apple.*"), "apples", IF(COUNTIF(A5, ".*pear.*"), "pears", "other") Pear B =IF(COUNTIF(A6, ".*apple.*"), "apples", IF(COUNTIF(A6, ".*pear.*"), "pears", "other") Melon =IF(COUNTIF(A7, ".*apple.*"), "apples", IF(COUNTIF(A7, ".*pear.*"), "pears", "other")  The basic IF statement format is TEST, TRUE_ACTION, FALSE_ACTION. Since Calc doesn't care if we use multiple lines in the formula, we can break it up into a more manageable version with nested IF functions. Consider: =IF(TEST1, TRUE_TEST1, IF(TEST2, TRUE_TEST2, IF(TEST3, TRUE_TEST3, ... )))  This makes writing the above formula more approachable, in, say, a text editor (Notepad, Gedit, TextWrangler, etc.). For example: =IF(COUNTIF(A2, ".*apple.*"), "ANSWER IF CONTAINS APPLES", IF(COUNTIF(A2, ".*pear.*"), "ANSWER IF CONTAINS PEARS", "UNKNOWN FALLBACK"))  Then, once the formula is written, just fill down. 2014-01-29 21:30:08 +0200 質問に回答する How do I uninstall LibreOffice? How you remove LibreOffice depends on your operating system (OS) and how you installed it. Linux: Open up your package manager, search for LibreOffice, and click the "Remove" button. (Instructions for Ubuntu.) Mac: Open up the Applications folder, find LibreOffice, and click-drag it to the Trash. Empty the trash. Here are graphical instructions. Windows 7: Follow these instructions). Windows 8: Follow these instructions. 2014-01-29 21:12:43 +0200 コメント付き質問 How can I open file with extension exe : z_downloader.exe ? This is a general computing question, not appropriate for this forum. This forum is for questions pertaining to LibreOffice. 2014-01-29 21:11:51 +0200 バッジを受け取った ● 市民パトロール (source) 2014-01-29 21:08:49 +0200 質問に回答する Libre Office 4.1.4,installation package cannot be opened, Contact the Application vendor to verify that this is a valid Windows Installer package Unfortunately, in the absence of more information, this is awfully hard to diagnose. My first suspicion is that your download was somehow corrupted. When you download a file, you are effectively copying that file from another computer. The normal web protocol (http:// - that prefix at the beginning of URLs) has no error checking built-in, so if a few bytes get corrupted in transport, that's it. Bittorrent is another method of download that breaks up large files into "manageable chunks". Each chunk is "signed" such that if a chunk is corrupted in transport, Bittorrent knows and can correct the issue. So, to at least rule out a corrupted download, you could: Try downloading the MSI file again and hope it works. Install a Bittorrent application, and then download the "Torrent" description, rather than the "Main installer". Open that file with the Bittorrent application and wait until the download completes. This will at least ensure that your copy is not corrupted. 2014-01-29 20:25:18 +0200 バッジを受け取った ● 人気の質問 (source) 2014-01-29 20:25:18 +0200 バッジを受け取った ● 卓越した質問 (source) 2014-01-29 20:25:18 +0200 バッジを受け取った ● 有名な質問 (source) 2014-01-29 20:07:30 +0200 質問に回答する Entering formula: Get list of available functions.... Calc does not have this functionality, currently. If you believe this to be a problem (and I might concur with you), I suggest you file an enhancement request. If you do file one, please post a link to it by using the form "fdo#123" (the system will automatically link to the bug report, number 123 in this case). Meanwhile, a workaround would be to use the "Fx" button to open a dialog box the help you write your formulas. This dialog box contains all functions in list form with a quick synopsis and appropriate input fields for each. It's not what you desire, but it's better than nothing, I suppose. 2014-01-13 13:21:51 +0200 バッジを受け取った ● 卓越した質問 (source) 2014-01-13 13:21:51 +0200 バッジを受け取った ● 有名な質問 (source) 2013-10-01 19:59:44 +0200 ベストアンサーマーク A navigable list of workbook tabs? Over the past 2 months, I have found myself working with workbooks that contain an average of 80 tabs. Unfortunately, it is quite a pain to navigate to the tab I need, for example while reading a formula, writing a formula, or reading data. Is there an more efficient method of navigation than scrolling through the tabs at the bottom of the window, or using Ctrl+PgUp and +PgDn? 2013-10-01 19:44:33 +0200 ベストアンサーマーク How to import UNO exceptions? I'm working on a Python application that uses a running LO instance. I'd like to know how to import the LO specific exceptions that may occur when running my program. Background below, but the prompting motivation for this question is that I want to catch the specific LO error "NoConnectException". How do I import this error from UNO? No iteration of "from uno import ..." I've tried seems to work. Background: When a program exception occurs that is actionable, the "Pythonic way" is to be as specific about handling it as possible. For instance, if I have a list of 5 elements, and I try to select the 6th one, that is more specifically an IndexError, rather than just a general Exception. Thus, instead of code like this: my_list = [1, 2, 3, 4, 5] # indexed from 0 through 4 i = 5 try: num = my_list[i] except Exception as e: print("You insensitive clod! {} is not a valid index!").format( i )  it is better to use the specific error you intend to handle, thus preventing the masking of an actual error: my_list = [1, 2, 3, 4, 5] # indexed from 0 through 4 i = 5 try: num = my_list[5] except IndexError as e: print("You insensitive clod! {} is not a valid index!").format( i )  How do I import the LO specific errors that can occur? I've tried a number of iterations, but I don't know where to look these up and api.libreoffice.org is not (currently) proving much help to me. 2013-10-01 19:29:25 +0200 ベストアンサーマーク How to *precisely* align various writer form elements? Consider a table of N rows by 2 columns, where each cell is an input element. Imagine now that row 4 has one cell slightly higher than the other. Imagine that at row 5 it gets slightly worse, and by row 15, one of the cells is a half-cell farther down the page than the other. That was the problem I was having when trying to line up two columns of input elements. I finally got it, but via a very gross method of unzipping and hand-editing the saved ODT file. I'm assuming I missed a large something in the GUI. What? My original attack plan was: Roughly align the various input elements with the mouse. Right-click on each element, and specify an exact placement and size, such that mathematically, each cell should be aligned. (e.g. left column has width of 2", right has width of 5", both top cells start at 3" down the page, and each row has a height of 0.3") That didn't work, so after many hours of futzing, I finally unzipped the ODT file and manually aligned the various elements to exact inches. There has got to be a better way to precisely align various form elements. Any hints? 2013-09-25 09:47:54 +0200 バッジを受け取った ● 卓越した質問 (source) 2013-07-25 15:38:51 +0200 コメント付き回答 How to NOT connect to a running instance Heh. It actually doesn't matter. The quotes are interpreted by the shell and are only required if there are "special characters" (e.g., spaces). They become more necessary if you want more robust behavior when interacting with unknown (user) input or variables, so using them as a matter of habit is just good practice. In this case, both methods will give LibreOffice the exact same string (with no quotes because the shell will remove them). 2013-07-24 20:04:10 +0200 バッジを受け取った ● 良い回答 (source) 2013-07-24 20:04:10 +0200 バッジを受け取った ● よくわかっていらっしゃる (source)