Reference manual for OOo Basic

Keyboard macros or custom scripts

Reference manual for OOo Basic

Postby Paddy Landau » Mon May 19, 2008 11:03 am

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?
Ubuntu Hardy 8.04, OpenOffice.org 3.1.1 build 9420
User avatar
Paddy Landau
 
Posts: 153
Joined: Wed Nov 28, 2007 12:52 pm

Re: Reference manual for OOo Basic

Postby Villeroy » Mon May 19, 2008 11:33 am

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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reference manual for OOo Basic

Postby Paddy Landau » Mon May 19, 2008 12:22 pm

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   Expand viewCollapse view
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).
Ubuntu Hardy 8.04, OpenOffice.org 3.1.1 build 9420
User avatar
Paddy Landau
 
Posts: 153
Joined: Wed Nov 28, 2007 12:52 pm

Re: Reference manual for OOo Basic

Postby Villeroy » Mon May 19, 2008 12:59 pm

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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reference manual for OOo Basic

Postby Paddy Landau » Mon May 19, 2008 1:59 pm

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.
Ubuntu Hardy 8.04, OpenOffice.org 3.1.1 build 9420
User avatar
Paddy Landau
 
Posts: 153
Joined: Wed Nov 28, 2007 12:52 pm

Re: Reference manual for OOo Basic

Postby Paddy Landau » Mon May 19, 2008 2:06 pm

I've installed the add-on. It's rather handy!
Ubuntu Hardy 8.04, OpenOffice.org 3.1.1 build 9420
User avatar
Paddy Landau
 
Posts: 153
Joined: Wed Nov 28, 2007 12:52 pm

Re: Reference manual for OOo Basic

Postby kingfisher » Tue May 20, 2008 5:49 am

I have some notes of various resources at http://kingfisher.wikidot.com/insert:ooscript
OpenOffice 3.3 on PCLinuxOS. There are 3 kinds of people: those who can count and those who can't.
User avatar
kingfisher
Volunteer
 
Posts: 1861
Joined: Tue Nov 20, 2007 10:53 am

Re: Reference manual for OOo Basic

Postby Paddy Landau » Tue May 20, 2008 7:54 am

Thanks. I've bookmarked the page and will go through that, too.
Ubuntu Hardy 8.04, OpenOffice.org 3.1.1 build 9420
User avatar
Paddy Landau
 
Posts: 153
Joined: Wed Nov 28, 2007 12:52 pm

Re: Reference manual for OOo Basic

Postby Craig9173 » Fri May 13, 2011 12:15 pm

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   Expand viewCollapse view
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)
OpenOffice 3.3.0 on Windows 7 Toshiba NB305 netbook
Craig9173
 
Posts: 1
Joined: Fri May 13, 2011 12:09 pm

Re: Reference manual for OOo Basic

Postby RoryOF » Fri May 13, 2011 12:36 pm

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.
Apache OpenOffice 4.0.1 on Xubuntu 13.10 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 14346
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Reference manual for OOo Basic

Postby rudolfo » Mon May 16, 2011 1:34 pm

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   Expand viewCollapse view
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.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
rudolfo
Volunteer
 
Posts: 1415
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Reference manual for OOo Basic

Postby franc » Sat Feb 04, 2012 4:24 pm

OpenOffice 3.3
franc
 
Posts: 7
Joined: Sat Oct 08, 2011 2:12 pm

Re: Reference manual for OOo Basic

Postby Villeroy » Sat Feb 04, 2012 4:41 pm

franc wrote:http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Cells_and_Ranges

was helpful for me.

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   Expand viewCollapse view
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   Expand viewCollapse view
oCell = ThisComponent.Sheets.getCellByPosition(3,2,1)   ' Cell D3 on second sheet
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reference manual for OOo Basic

Postby franc » Sat Feb 04, 2012 5:23 pm

Coming from VBA with IntelliSense and a good integrated help, it is hard and stony to get started with SB.
OpenOffice 3.3
franc
 
Posts: 7
Joined: Sat Oct 08, 2011 2:12 pm

Re: Reference manual for OOo Basic

Postby Villeroy » Sat Feb 04, 2012 6:50 pm

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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Reference manual for OOo Basic

Postby franc » Sun Feb 05, 2012 2:06 am

Yes, it is really different ;)
Having now installed the MRI, Xray, SDK. Reading the doc and exploring the objects...

Thank it.
OpenOffice 3.3
franc
 
Posts: 7
Joined: Sat Oct 08, 2011 2:12 pm

Re: Reference manual for OOo Basic

Postby franc » Sun Feb 05, 2012 2:59 pm

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.
OpenOffice 3.3
franc
 
Posts: 7
Joined: Sat Oct 08, 2011 2:12 pm

Re: Reference manual for OOo Basic

Postby FJCC » Sun Feb 05, 2012 5:27 pm

I think I can help with your question, but please start a new topic so that others can find the answer also.
AOO 3.4 or 4.0 on MS Windows XP ( before 2013-08-03) or Windows 7
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 3672
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Reference manual for OOo Basic

Postby franc » Sun Feb 05, 2012 7:43 pm

FJCC wrote:...but please start a new topic...

I did it:

viewtopic.php?f=45&t=47571
OpenOffice 3.3
franc
 
Posts: 7
Joined: Sat Oct 08, 2011 2:12 pm


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 3 guests