User Tools

Site Tools


info:openoffice

OpenOffice

IDE Plugins

OpenOffice plugin 1.1.2 on Netbeans 6.1 causes an exception when opening non-OpenOffice Java projects; as a workaround, it seems that one is able to disable the plugin, open/create the project(s), and re-enable the plugin when required again.

On Ubuntu

  • In Ubuntu, set the OpenOffice.org installation directory to /usr/lib/openoffice and the SDK directory to /usr/lib/openoffice/sdk
  • At the time of writing, 2008-06-26, the /usr/lib/openoffice/sdk/linux/bin directory contained scripts that used the construct "basename $0"; this caused some trouble. Changing to the actual name of the script fixes it.

Column number to column name

http://www.oooforum.org/forum/viewtopic.phtml?p=23013#23013

Function CalcColumnNumberToName( oSheet As com.sun.star.sheet.Spreadsheet,_
                     nColumnNumber As Long ) As String
   oColumns = oSheet.getColumns()
   oColumn = oColumns.getByIndex( nColumnNumber )
   cColumnName = oColumn.getName()
   CalcColumnNumberToName() = cColumnName
End Function
Function ColumnNameOf( nColumnNumber As Long ) As String
   oDoc = ThisComponent
   oSheet = oDoc.getSheets().getByIndex( 0 ) ' there must always be a zero'th sheet!
   oColumns = oSheet.getColumns()
   oColumn = oColumns.getByIndex( nColumnNumber )
   cColumnName = oColumn.getName()
   ColumnNameOf() = cColumnName
End Function 

Number Format

Find or create a number format, based on a string (like "MM/DD/YYYY" or "HH:MM AM/PM"; anything in the "Format Cells…" dialog).

'Find or create a number format style.
'Found at:
'http://codesnippets.services.openoffice.org/Office/Office.NumberFormats.snip
'******************************************************************
'Author: Andrew Pitonyak
'email:   andrew@pitonyak.org
Function FindCreateNumberFormatStyle (_
  sFormat As String, Optional doc, Optional locale)
  Dim oDocument As Object
  Dim aLocale as new com.sun.star.lang.Locale
  Dim oFormats As Object
  oDocument = IIf(IsMissing(doc), ThisComponent, doc)
  oFormats = oDocument.getNumberFormats()
  'If you choose to query on types, you need to use the type
  'com.sun.star.util.NumberFormat.DATE
  'I could set the locale from values stored at
  'http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
  'http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
  'I use a NULL locale and let it use what ever it likes.
  'First, see if the number format exists
  If ( Not IsMissing(locale)) Then
    aLocale = locale
  End If
  Dim formatNum as long
  formatNum = oFormats.queryKey (sFormat, aLocale, TRUE)
  MsgBox "Current Format number is" & formatNum
  'If the number format does not exist then add it
  If (formatNum = -1) Then
    formatNum = oFormats.addNew(sFormat, aLocale)
    If (formatNum = -1) Then formatNum = 0
    MsgBox "new Format number is " & formatNum
  End If
  FindCreateNumberFormatStyle = formatNum
End Function

Non-modal dialogs

To run the dialog, do something like:

Dim done as boolean
 
Sub RunDlg
	oDlg.setVisible(True)
	done = False
	do until done
		wait 1000
	loop
	oDlg.setVisible(False) 'Just to make sure; shouldn't be needed
End Sub

You need to change the button types to Default, and give them handlers that set the done variable to True and the visibility to false, e.g.:

Sub Cancel_Button
	done = True
	oDlg.setVisible(False)
End Sub
info/openoffice.txt · Last modified: 2008-06-26 14:07 by sam