The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


OpenOffice::OOCBuilder - Perl OO interface for creating OpenOffice Spreadsheets


  use OpenOffice::OOCBuilder;

  This constructor will call the constructor of OOBuilder.


OOCBuilder is a Perl OO interface to create OpenOffice spreadsheets. Documents can be created with multiple sheets, different styles, cell types, formulas, column widths and so on.



  Create a new spreadsheet object


  Add a new sheet within the document. Active sheet is not changed.
  You need to call goto_sheet (sheetnumber) to change the active

goto_sheet ($sheetnumber)

  Set $sheetnumber as active sheet.

set_sheet_name ($name, $sheetnumber)

  Set the name of the sheet. If $sheetnumber is ommitted (or 0), the
  name of the active sheet is set.

set_colwidth ($c, $width)

  Set the column width for the specified column ($c). The column can
  be a number or letter(s).

set_rowheight ($r, $height)

  Set the row height for the specified row ($r).

goto_xy ($c, $r)

  Set the active cell to ($c, $r). The column can be specified by
  number or letter(s).

goto_cell ($cell_id)

  Set the active cell to ($cell_id). This way you can use spreadsheet
  notations (i.e. A5 or BA401 and so on)


  Returns the active column in letters.


  Returns the active column as a number (starting at 1).


  Returns the row as a number (starting at 1)


  Returns the row as a number (starting at 1). Same as get_row.


  Returns the column and row as two numbers in a list.


  Returns the cell id in the form A1, AB564, and so on. Especially handy
  to create formulas. When you are at the start position, memorise the
  cell_id. See in the examples directory.

set_data ($data, $type, $format)

  Set data in the active cell within the active sheet. If type is ommitted
  the standard type is taken.

set_data_xy ($c, $r, $data, $type, $format)

  Same as set_data, but now with column and row to set the data in. The
  column can be specified as a number or with letter(s).

set_data_sheet_xy ($sheet, $c, $r, $data, $type, $format)

  Same as set_data, but now with sheet, column and row to set the data in.
  The column can be specified as a number or with letter(s).

set_auto_xy ($x, $y)

  When entering data in a cell, we move to another cell if auto_x or y
  is set.
   X value: 0: no movement, negative: move left, positive: move right.
   Y valye: 0: no movement, negative: move up, positive: move down.


  Returns the auto_x value.


  Returns the auto_y value.


  This method is called always when entering data in a cell. If auto_x
  or auto_y is set, if will move to another active cell. You can also
  use this method to move to another cell without entering data in the
  previous cell.

move_cell ($direction, $number)

  Move to cell in $direction where $direction is 'left', 'right', 'up' or
  'down'. If you ommit $number, the move will be one row or column.

generate ($tgtfile)

  Generates the sxc file. $tgtfile is the name of the target file without
  extension. If no name is supplied, the default name will be used,
  which is oo_doc. The target directory is '.', you can set this by
  calling the OOBuilder method set_builddir ($builddir).

Setting the style and meta data

  See OpenOffice::OOBuilder, because these methods are directly
  inherited from the base class.


Look at the examples directory supplied together with this distribution.

SEE ALSO - the base class

Bug reports and questions can be sent to <oobuilder(at)>. Attention: make sure the word <oobuilder> is in the subject or body of your e-mail. Otherwhise your e-mail will be taken as spam and will not be read.


Stefan Loones


Copyright 2004, 2005 by Stefan Loones

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.