User Tools

Site Tools



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 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

Function CalcColumnNumberToName( oSheet As,_
                     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:
'Author: Andrew Pitonyak
Function FindCreateNumberFormatStyle (_
  sFormat As String, Optional doc, Optional locale)
  Dim oDocument As Object
  Dim aLocale as new
  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
  'I could set the locale from values stored at
  '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
	done = False
	do until done
		wait 1000
	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
End Sub
info/openoffice.txt · Last modified: 2008-06-26 14:07 by sam