Page 1 of 1

Reference manual for OOo Basic

Posted: Mon May 19, 2008 11:03 am
by Paddy Landau
This is probably a dumb question that's been asked elsewhere, and unfortunately I can't find the answer:

I've searched high and low, and can't find a simple reference manual for OOo Basic.

For example:
  • What values TextWrap could take?
  • What command would let me insert a picture into a Writer document?
And so on.

Where is the reference manual for OOo Basic, please?

Re: Reference manual for OOo Basic

Posted: Mon May 19, 2008 11:33 am
by Villeroy
The Basic language is almost completely documented in the online help. What you want is the documentation of the thing you talk to. Basic is one of several languages that can be used to put a spell on the office API. The topmost link in this forum's Macros and API Forum provides a good starting point.

Re: Reference manual for OOo Basic

Posted: Mon May 19, 2008 12:22 pm
by Paddy Landau
Hmm...

Thanks for the pointer. I have gone through that (the Basic Programming Guide) already.

Are you saying that, having gone through the tutorial, I should look at the API documentation?

For example, how would I know how to use a selected object? (I know it's as follows, but how would I know if someone hadn't told me?)

Code: Select all

Dim MyItem as Object
MyItem = ThisComponent.CurrentSelection
That's what I'm trying to get at. Where is the documentation that will help me learn this stuff?

For example, I want to change the current selection (which is a picture) to having "Wrap Through" (MyItem.TextWrap = 1) but also "In background" (and I can't find out how to do that).

Re: Reference manual for OOo Basic

Posted: Mon May 19, 2008 12:59 pm
by Villeroy
Once you are familiar with the general structure (UNO with it's services and interfaces) you can lookup things quickly from the reference. The debug window in the Basic editor exposes most of the used objects. You may have a look at the macros that ship with OOo. Some of them are introspective.
A local copy of the Software Development Kit includes the whole reference plus developer's guide both in html. The binary tools are needed for compiling programs in C++ or Java.
Writing scripts in Basic, BeanShell, JavaScript or Python and having a local copy of the SDK you certainly want to install the xray tool (47 matches when searching this forum).

Oh, and then there is a firefox plugin https://addons.mozilla.org/de/firefox/addon/4102 comprising the most important(?) sources of information.

Re: Reference manual for OOo Basic

Posted: Mon May 19, 2008 1:59 pm
by Paddy Landau
Wow! Thanks, Villeroy.

I'm just wanting to write simple macros for repetitive work in my text documents, so it may be too much. I'll take a look and see what I need and if I can use just the basic bits!

Thanks again.

Re: Reference manual for OOo Basic

Posted: Mon May 19, 2008 2:06 pm
by Paddy Landau
I've installed the add-on. It's rather handy!

Re: Reference manual for OOo Basic

Posted: Tue May 20, 2008 5:49 am
by kingfisher
I have some notes of various resources at http://kingfisher.wikidot.com/insert:ooscript

Re: Reference manual for OOo Basic

Posted: Tue May 20, 2008 7:54 am
by Paddy Landau
Thanks. I've bookmarked the page and will go through that, too.

Re: Reference manual for OOo Basic

Posted: Fri May 13, 2011 12:15 pm
by Craig9173
Paddy Landau wrote:Hmm...

Thanks for the pointer. I have gone through that (the Basic Programming Guide) already.

Are you saying that, having gone through the tutorial, I should look at the API documentation?

For example, how would I know how to use a selected object? (I know it's as follows, but how would I know if someone hadn't told me?)

Code: Select all

Dim MyItem as Object
MyItem = ThisComponent.CurrentSelection
That's what I'm trying to get at. Where is the documentation that will help me learn this stuff?

For example, I want to change the current selection (which is a picture) to having "Wrap Through" (MyItem.TextWrap = 1) but also "In background" (and I can't find out how to do that).
I am in the same boat, I understand the basic bits and bobs, but I am trying to understand how to reference a cell. unfortunately I can only describe this with blasphemy, myvariable = worksheets("sheet1").cells(3,4)

I dont really understand what UNO or API are, I do understand what basic is (Fortran 77 is where I cut my programming teeth, but unfortunately that is where I have stayed for 20 years)

Re: Reference manual for OOo Basic

Posted: Fri May 13, 2011 12:36 pm
by RoryOF
API stands for Application Programming Interface and UNO for Universal Network Objects; for people who started on Fortran (F II in my case) and BASIC, they are a major change in concept. Pascal and Modula 2 were straightforward, but then C and its various varieties did not sit well (for me at any rate) with the structured logic of Pascal and Modula. One really misses a printed out reference manual for the API etc for a specific application.

Re: Reference manual for OOo Basic

Posted: Mon May 16, 2011 1:34 pm
by rudolfo
Craig, you jumped onto an old thread. In general the Macro Forum has a sticky topmost thread now that reflects a discussion on how to find documentation. Short summary: Wiki documenation on Basic, UNO API documentation, Tutorials, Inspection tools (MRI, Xray)
In your case coming from MS Office and VBA the document VBA - StarBasic Cross Reference might also be helpful.
At the end you should find something like the following for your question:

Code: Select all

oSheet = ThisComponent.getSheets().getByName("Sheet1")
oCell = oSheet.getCellByPosition(3,2)   ' Cell D3
OpenOfffice counts cells in a table starting from index 0 and the first parameter is the column and the second the row.

Re: Reference manual for OOo Basic

Posted: Sat Feb 04, 2012 4:24 pm
by franc

Re: Reference manual for OOo Basic

Posted: Sat Feb 04, 2012 4:41 pm
by Villeroy
It gives a cooking receipt for a tiny problem you may have at this moment. It does not explain anything. Next time you need another receipt.
rudolfo wrote: At the end you should find something like the following for your question:

Code: Select all

oSheet = ThisComponent.getSheets().getByName("Sheet1")
oCell = oSheet.getCellByPosition(3,2)   ' Cell D3
OpenOfffice counts cells in a table starting from index 0 and the first parameter is the column and the second the row.
Or even

Code: Select all

oCell = ThisComponent.Sheets.getCellByPosition(3,2,1)   ' Cell D3 on second sheet

Re: Reference manual for OOo Basic

Posted: Sat Feb 04, 2012 5:23 pm
by franc
Coming from VBA with IntelliSense and a good integrated help, it is hard and stony to get started with SB.

Re: Reference manual for OOo Basic

Posted: Sat Feb 04, 2012 6:50 pm
by Villeroy
franc wrote:Coming from VBA with IntelliSense and a good integrated help, it is hard and stony to get started with SB.
Coming from VBA, anything else is difficult. Just change your tools and your mind set. Install the MRI extension, explore its capabilities.

Re: Reference manual for OOo Basic

Posted: Sun Feb 05, 2012 2:06 am
by franc
Yes, it is really different ;)
Having now installed the MRI, Xray, SDK. Reading the doc and exploring the objects...

Thank it.

Re: Reference manual for OOo Basic

Posted: Sun Feb 05, 2012 2:59 pm
by franc
It becomes...
But slowly :)

One little question: How can I set the cursor to the last position, when I want to create a new text document and fill it with text from a database?
I want to sequentially fill a new text document paragraph by paragraph with content (strings) from a calc-"database", e.g.:

Fill one new paragraph1 with StringA, then StringB, then StringC.
Fill one new paragraph2 with StringD, then StringE, then StringF.
Fill one new paragraph3 with ...
...
Fill paragraphN with String N, then StringN+1, then StringN+2

Sorry when asking this, maybe I should use other subforum?
thank anyway.

Re: Reference manual for OOo Basic

Posted: Sun Feb 05, 2012 5:27 pm
by FJCC
I think I can help with your question, but please start a new topic so that others can find the answer also.

Re: Reference manual for OOo Basic

Posted: Sun Feb 05, 2012 7:43 pm
by franc
FJCC wrote:...but please start a new topic...
I did it:

http://user.services.openoffice.org/en/ ... 45&t=47571