module PIM::Services::ExcelService

Public Instance Methods

__excel_service() click to toggle source
# File services.rb, line 1384
def __excel_service
  __service(:excelService)
end
create_sheet(workbook, sheetname) click to toggle source

creates a new sheet with a sheet name in a workbook

# File services.rb, line 1370
def create_sheet workbook, sheetname
  __excel_service.create_sheet(workbook, sheetname)
end
create_xls_workbook() click to toggle source
# File services.rb, line 1273
def create_xls_workbook
  __excel_service.create_xls_workbook
end
create_xlsx_stream_writing_workbook() click to toggle source
# File services.rb, line 1239
def create_xlsx_stream_writing_workbook
  __excel_service.create_xlsx_stream_writing_workbook
end
create_xlsx_workbook() click to toggle source
# File services.rb, line 1235
def create_xlsx_workbook
  __excel_service.create_xlsx_workbook
end
get_cell_value(workbook, cell_name) click to toggle source
# File services.rb, line 1295
def get_cell_value workbook, cell_name
  __excel_service.get_cell_value(workbook, cell_name)
end
Also aliased as: read_excel_cell
get_cell_value_at(workbook, sheetnum, rownum, colnum) click to toggle source
# File services.rb, line 1320
def get_cell_value_at workbook, sheetnum, rownum, colnum
  __excel_service.get_cell_value_at(workbook, sheetnum, rownum, colnum)
end
get_next_row(row_iterator) click to toggle source

Get the next non nil row from a row iterator, or nil if no more rows are available.

# File services.rb, line 1347
def get_next_row row_iterator
  row_iterator.each do |row|
    return row if not row.nil?
  end
  nil
end
get_row_cell_value_at(row, colnum) click to toggle source
# File services.rb, line 1340
def get_row_cell_value_at row, colnum
  __excel_service.get_cell_value_at(row, colnum)
end
get_row_cell_values(row) click to toggle source
# File services.rb, line 1336
def get_row_cell_values row
  __excel_service.get_row_cell_values(row)
end
get_row_cell_values_at(workbook, sheetnum, rownum) click to toggle source
# File services.rb, line 1328
def get_row_cell_values_at workbook, sheetnum, rownum
  __excel_service.get_row_cell_values_at(workbook, sheetnum, rownum)
end
get_sheet_cell_value_at(sheet, rownum, colnum) click to toggle source
# File services.rb, line 1324
def get_sheet_cell_value_at sheet, rownum, colnum
  __excel_service.get_cell_value_at(sheet, rownum, colnum)
end
get_sheet_row_cell_values_at(sheet, rownum) click to toggle source
# File services.rb, line 1332
def get_sheet_row_cell_values_at sheet, rownum
  __excel_service.get_row_cell_values_at(sheet, rownum)
end
iterate_rows(row_iterator, start_row_num = nil, end_row_num = nil, &block) click to toggle source

Iterate using a row iterator and call the specified block on all non nil rows. If a start_row_num is defined, don’t call the block if the current row_num is below it. If a end_row_num is defined, stop the iteration if the current row_num is above it.

# File services.rb, line 1359
def iterate_rows row_iterator, start_row_num = nil, end_row_num = nil, &block
  row_iterator.each do |row|
    next if row.nil?
    row_num = row.get_row_num
    next if start_row_num and row_num < start_row_num
    break if end_row_num and row_num > end_row_num
    block.call(row)
  end
end
open_xls_workbook(path_or_stream = nil, gathering_key = nil) click to toggle source
# File services.rb, line 1277
def open_xls_workbook path_or_stream = nil, gathering_key = nil
  if path_or_stream.nil? and gathering_key.nil?
    create_xls_workbook
  elsif path_or_stream.is_a?(String) and not gathering_key.nil?
    __excel_service.open_xls_workbook(path_or_stream, gathering_key)
  else
    __excel_service.open_xls_workbook(path_or_stream)
  end
end
open_xlsx_stream_reading_workbook(path_or_stream, gathering_key = nil) click to toggle source
# File services.rb, line 1253
def open_xlsx_stream_reading_workbook path_or_stream, gathering_key = nil
  if path_or_stream.nil?
    raise "Path or stream must be specified"
  elsif path_or_stream.is_a?(String) and not gathering_key.nil?
    __excel_service.open_xlsx_stream_reading_workbook(path_or_stream, gathering_key)
  else
    __excel_service.open_xlsx_stream_reading_workbook(path_or_stream)
  end
end
open_xlsx_stream_writing_workbook(path_or_stream = nil, gathering_key = nil) click to toggle source
# File services.rb, line 1263
def open_xlsx_stream_writing_workbook path_or_stream = nil, gathering_key = nil
  if path_or_stream.nil? and gathering_key.nil?
    create_xlsx_stream_writing_workbook
  elsif path_or_stream.is_a?(String) and not gathering_key.nil?
    __excel_service.open_xlsx_stream_writing_workbook(path_or_stream, gathering_key)
  else
    __excel_service.open_xlsx_stream_writing_workbook(path_or_stream)
  end
end
open_xlsx_workbook(path_or_stream = nil, gathering_key = nil) click to toggle source
# File services.rb, line 1243
def open_xlsx_workbook path_or_stream = nil, gathering_key = nil
  if path_or_stream.nil? and gathering_key.nil?
    create_xlsx_workbook
  elsif path_or_stream.is_a?(String) and not gathering_key.nil?
    __excel_service.open_xlsx_workbook(path_or_stream, gathering_key)
  else
    __excel_service.open_xlsx_workbook(path_or_stream)
  end
end
read_excel_cell(workbook, cell_name)
Alias for: get_cell_value
remove_sheet(workbook, sheetname) click to toggle source

removes a sheet with sheet_name

# File services.rb, line 1380
def remove_sheet workbook, sheetname
  __excel_service.remove_sheet(workbook, sheetname)
end
remove_sheet_at(workbook, index) click to toggle source

removes a sheet with index

# File services.rb, line 1375
def remove_sheet_at workbook, index
  __excel_service.remove_sheet_at(workbook, index)
end
save_workbook(workbook, path_or_stream = nil, gathering_key = nil) click to toggle source
# File services.rb, line 1287
def save_workbook workbook, path_or_stream = nil, gathering_key = nil
  if path_or_stream.is_a?(String) and not gathering_key.nil?
    __excel_service.save_workbook(workbook, path_or_stream, gathering_key)
  else
    __excel_service.save_workbook(workbook, path_or_stream)
  end
end
set_cell_value(workbook, cell_name, value) click to toggle source
# File services.rb, line 1305
def set_cell_value workbook, cell_name, value
  __excel_service.set_cell_value(workbook, cell_name, value)
end
Also aliased as: write_excel_cell
set_cell_value_at(workbook, sheetnum_or_sheetname, cell_name, value) click to toggle source

write cell value at a given sheet on the workbook

# File services.rb, line 1310
def set_cell_value_at workbook, sheetnum_or_sheetname, cell_name, value
  __excel_service.set_cell_value_at(workbook, sheetnum_or_sheetname, cell_name, value)
end
write_excel_cell(workbook, cell_name, value)
Alias for: set_cell_value