Sha256: cd5f6e89169672850f7f2bcad4602ab0ccf2123d455f2b0847402ba43eca8ef8

Contents?: true

Size: 1006 Bytes

Versions: 4

Compression:

Stored size: 1006 Bytes

Contents

# encoding: utf-8

class Workbook

  def initialize(java_wb)
    @wb = java_wb
  end

  # gets the name of this workbook
  def name
    @wb.getName
  end
  alias :getName :name

  # closes this workbook
  # +save+:: whether changes should be saved or not, default is +false+
  def close(save = false)
    @wb.close(save)
  end

  # saves this workbook
  def save
    @wb.save
  end

  # saves this workbook to a new location. Every further operations on this workbook will happen to the newly saved file.
  def save_as(path)
    @wb.saveAs(java.io.File.new(path))
  end
  alias :saveAs :save_as

  # adds and returns a worksheet to this workbook
  # +name+:: name of new worksheet
  def add_worksheet(name)
    Worksheet.new(@wb.addWorksheet(name))
  end
  alias :addWorksheet :add_worksheet

  # gets a worksheet
  # +name+:: name of worksheet to get
  def worksheet(name)
    Worksheet.new(@wb.getWorksheet(name))
  end
  alias :getWorksheet :worksheet

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jruby_excelcom-0.0.5-java lib/jruby_excelcom/workbook.rb
jruby_excelcom-0.0.4-java lib/jruby_excelcom/workbook.rb
jruby_excelcom-0.0.2-java lib/jruby_excelcom/workbook.rb
jruby_excelcom-0.0.1-java lib/jruby_excelcom/workbook.rb