Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Johnny,

You asked: "Is there a reason why you want to use that UNO dispatcher thing...?"

Yes. That's what I got from the macro recorder. I'm low on the learning curve.

I would love to learn about your "ThisComponent.getSheets().getByIndex(0).getCellByPosition(0,0).setValue(x)". Especially the ".setValue"!

That type of syntax I have not found anywhere in the LO Basic documentation. Can you point me to the source for this?

Thank you,
David


On Mon, 21 Nov 2011 09:08:41 -0800, Johnny Rosenberg <gurus.knugum@gmail.com> wrote:

2011/11/21 David S. Crampton <david_crampton@ie2b.com>:
I wish to perform some complex arithmetic operations on several variables. One such variable is "Firsta" as in the attachment below. I wish to enter the values of Firsta (and others) into cells in Calc. The only method I have
found for entering data into cells is the dispatcher statement using
"uno:EnterString". This I am using from the Macro recorder script.

The issue appears to be that "uno:EnterString" requires a string as its
parameter. If the parameter is a numeric (an integer in my case), the cell
is left empty.

How to enter an integer value from LO Basic into a cell without having to klutzy-convert it to a string? Is there an equivalent to Calc's "Text(ref,
format)" function that will execute in Basic?

I've searched Andrew's book (very good book) and other web resources about uno (very bad resources mostly). Andrew's book, however, doesn't include
the EnterString method in its uno chapter.

LO v3.4.4 on Windows XP Pro

~~~~~~~begin code fragment~~~~~~~~~~~~~~~~~
~~~~~~~this code works OK only because of the number-to-string
conversion~~~~~~~~~~~~~~~~~
Things = 9
Do
' WriteTriplet0
dim args5(1) as new com.sun.star.beans.PropertyValue
       args5(0).Name = "By"
       args5(0).Value = 1
       args5(1).Name = "Sel"
       args5(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5())
Select Case Firsta
       Case 1
 args1(0).Value = "1"
       Case 2
 args1(0).Value = "2"
       Case 3
 args1(0).Value = "3"
       Case 4
 args1(0).Value = "4"
End Select

dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args1())

Firsta = Firsta + 1
Loop While Firsta <= Things
~~~~~~~end code fragment~~~~~~~~~~~~~~~~~


--
David S. Crampton

Is there a reason why you want to use that UNO dispatcher thing or
whatever it is called. Why not just doing something like the
following?
Dim x As Integer
x=3
ThisComponent.getSheets().getByIndex(0).getCellByPosition(0,0).setValue(x)

Well, something like that, I didn't test it.


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.