libreoffice-basic

LibreOffice Basic get Elements from form

眉间皱痕 提交于 2019-12-12 22:36:01
问题 I'm trying to get value from textfield on the form. sub Test(oEv) oForm = oEv.Source.Model.Parent textBox = oForm.getByName("Description") MsgBox textBox.Text end sub There is an Exception: "Type: com.sun.star.container.NoSuchElementException" on the line "textBox = oForm.getByName". I have a text field with the name "Description" on the same form, where is the button I press to run this macro. What is wrong here? 回答1: Check that the name is the same case, not description . Also, use the Form

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

Updating database table with macro using data from form

邮差的信 提交于 2019-12-11 07:09:50
问题 I have a form in Libreoffice Base which is connected to the "Songs" table (basicaly db of music) and what I want to do is everytime I check/uncheck the CheckBox on that form I want the field "Played" of every record with the same name and Author as the one I have currently on the form to be checked/unchecked as well. I have read that the only way of doing so is with macros (as I don't want to use relations cause I have to many records for now). I've written such a macro: Sub UpdatePlayed()

Good usage of native functions in LibreOffice Basic?

ぃ、小莉子 提交于 2019-12-11 02:47:43
问题 I've read here that we can use a pretty complicated syntax in order to have access to LibreOffice functions in the Basic macro editor, rather than writing functions in a sheet and get the data back. Are there current best practices related to this problem, i.e. obtain a result without writing a formula to a sheet ? 来源: https://stackoverflow.com/questions/30195024/good-usage-of-native-functions-in-libreoffice-basic

How do I check for broken internal links in Star Basic?

穿精又带淫゛_ 提交于 2019-12-10 14:42:52
问题 I am creating a Basic macro for LibreOffice Writer to check for broken internal links. In a nutshell: generate a list of all anchors loop through the document, finding internal hyperlinks if the internal hyperlink is not on the anchor list, open it for editing (and stop) My code has a few unsolved issues: (within fnBuildAnchorList ) How do we get the numbering for each heading? For example, if the first level 1 heading text is “Introduction”, the correct anchor is #1.Introduction|outline and

Libreoffice : Referencing cells in another worksheet via FIND(), LOOKUP(), or EXACT()?

送分小仙女□ 提交于 2019-12-07 19:01:27
问题 I'm trying to learn LibreOffice's scripting capabilities, and have a specific scenario that I haven't been able to figure out. What I'm trying to do is get the value from another worksheet, by doing a search for a specific value in an adjacent cell. For example, lets say I have two worksheets: Worksheet1 And Worksheet2 What i'm trying to do, is populate each value in Worksheet1, Column B with the associated value from Worksheet2, Column B. The way I'm trying to do this is to write a statement

Function accessing cell range

北慕城南 提交于 2019-12-07 07:05:11
问题 I don't find how to use cell ranges with functions. I vainly searched some examples. I wrote the following test. I get "Object variable not set" error on both "for" lines (one is without "RangeAddress", and the second is with it, because I'm not sure of the correct syntax): function CHECKBZRANGE(cellRange) as integer dim nCol as integer dim nLine as integer dim i as integer for nCol = cellRange.StartColumn to cellRange.EndColumn for nLine = cellRange.RangeAddress.StartRow to cellRange

Function accessing cell range

筅森魡賤 提交于 2019-12-05 14:28:49
I don't find how to use cell ranges with functions. I vainly searched some examples. I wrote the following test. I get "Object variable not set" error on both "for" lines (one is without "RangeAddress", and the second is with it, because I'm not sure of the correct syntax): function CHECKBZRANGE(cellRange) as integer dim nCol as integer dim nLine as integer dim i as integer for nCol = cellRange.StartColumn to cellRange.EndColumn for nLine = cellRange.RangeAddress.StartRow to cellRange.RangeAddress.EndRow i = i + 1 ' placeholder for some computation next nLine next nCol checkBZ_range = i end

Calling C shared library function from LibreOffice Basic

丶灬走出姿态 提交于 2019-12-02 18:24:33
问题 I'm trying to call a C shared library function from LibreOffice Basic, but I always get "Basic Runtime Error. Not implemented" when it hits the Declare line. It's just for a fun thing but being unable to do it is bugging me. The Declare statement looks like this: Declare Function score_word Lib "libscrabblescore.so" (ByRef word As String, ByRef bonus As String) As Integer The C function delaration looks like this: int score_word(char* word, char* word_bonuses) (Maybe ByRef word As String is

Calling C shared library function from LibreOffice Basic

China☆狼群 提交于 2019-12-02 10:13:24
I'm trying to call a C shared library function from LibreOffice Basic, but I always get "Basic Runtime Error. Not implemented" when it hits the Declare line. It's just for a fun thing but being unable to do it is bugging me. The Declare statement looks like this: Declare Function score_word Lib "libscrabblescore.so" (ByRef word As String, ByRef bonus As String) As Integer The C function delaration looks like this: int score_word(char* word, char* word_bonuses) (Maybe ByRef word As String is not the right translation of char* word? I can't find documentation on how to use char* parameters to